UX: on mobile devices iOS or Android always use full screen login

This simplifies life for users and embedded browsers and works around
all popup blocking.

There is no point to popup tabs on Android or iOS, it just causes
confusion.
This commit is contained in:
Sam Saffron 2016-08-11 23:15:45 +10:00
parent 6075debc90
commit 58322617ec
3 changed files with 13 additions and 3 deletions

View file

@ -176,7 +176,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
authMessage: (function() { authMessage: (function() {
if (Ember.isEmpty(this.get('authenticate'))) return ""; if (Ember.isEmpty(this.get('authenticate'))) return "";
const method = findAll(this.siteSettings).findProperty("name", this.get("authenticate")); const method = findAll(this.siteSettings, this.capabilities, this.isMobileDevice).findProperty("name", this.get("authenticate"));
if(method){ if(method){
return method.get('message'); return method.get('message');
} }

View file

@ -22,7 +22,7 @@ const LoginMethod = Ember.Object.extend({
let methods; let methods;
let preRegister; let preRegister;
export function findAll(siteSettings) { export function findAll(siteSettings, capabilities, isMobileDevice) {
if (methods) { return methods; } if (methods) { return methods; }
methods = []; methods = [];
@ -55,6 +55,12 @@ export function findAll(siteSettings) {
}); });
preRegister = undefined; preRegister = undefined;
} }
// On Mobile, Android or iOS always go with full screen
if (isMobileDevice || capabilities.isIOS || capabilities.isAndroid) {
methods.forEach(m=>m.set("fullScreenLogin", true));
}
return methods; return methods;
} }

View file

@ -204,7 +204,11 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
}, },
_autoLogin(modal, modalClass, notAuto) { _autoLogin(modal, modalClass, notAuto) {
const methods = findAll(this.siteSettings);
const methods = findAll(this.siteSettings,
this.container.lookup('capabilities:main'),
this.site.isMobileDevice);
if (!this.siteSettings.enable_local_logins && methods.length === 1) { if (!this.siteSettings.enable_local_logins && methods.length === 1) {
this.controllerFor('login').send('externalLogin', methods[0]); this.controllerFor('login').send('externalLogin', methods[0]);
} else { } else {