diff --git a/app/assets/javascripts/discourse/controllers/login.js.es6 b/app/assets/javascripts/discourse/controllers/login.js.es6 index d5e6042c7b4..1be438faea9 100644 --- a/app/assets/javascripts/discourse/controllers/login.js.es6 +++ b/app/assets/javascripts/discourse/controllers/login.js.es6 @@ -29,6 +29,7 @@ export default Ember.Controller.extend(ModalFunctionality, { processingEmailLink: false, showLoginButtons: true, showSecondFactor: false, + awaitingApproval: false, canLoginLocal: setting("enable_local_logins"), canLoginLocalWithEmail: setting("enable_local_logins_via_email"), @@ -42,7 +43,8 @@ export default Ember.Controller.extend(ModalFunctionality, { loggedIn: false, secondFactorRequired: false, showSecondFactor: false, - showLoginButtons: true + showLoginButtons: true, + awaitingApproval: false }); }, @@ -56,6 +58,14 @@ export default Ember.Controller.extend(ModalFunctionality, { return showSecondFactor ? "" : "hidden"; }, + @computed("awaitingApproval", "hasAtLeastOneLoginButton") + modalBodyClasses(awaitingApproval, hasAtLeastOneLoginButton) { + let classes = ["login-modal"]; + if (awaitingApproval) classes.push("awaiting-approval"); + if (hasAtLeastOneLoginButton) classes.push("has-alt-auth"); + return classes.join(" "); + }, + // Determines whether at least one login button is enabled @computed("canLoginLocalWithEmail") hasAtLeastOneLoginButton(canLoginLocalWithEmail) { @@ -298,6 +308,14 @@ export default Ember.Controller.extend(ModalFunctionality, { }); } + if ( + options.awaiting_approval && + !this.get("canLoginLocal") && + !this.get("canLoginLocalWithEmail") + ) { + this.set("awaitingApproval", true); + } + if (options.omniauth_disallow_totp) { return loginError(I18n.t("login.omniauth_disallow_totp"), "error", () => { this.setProperties({ diff --git a/app/assets/javascripts/discourse/templates/mobile/modal/login.hbs b/app/assets/javascripts/discourse/templates/mobile/modal/login.hbs index ad6101bea8d..594ea48603d 100644 --- a/app/assets/javascripts/discourse/templates/mobile/modal/login.hbs +++ b/app/assets/javascripts/discourse/templates/mobile/modal/login.hbs @@ -1,5 +1,5 @@ {{#login-modal screenX=lastX screenY=lastY loginName=loginName loginPassword=loginPassword secondFactorToken=secondFactorToken action=(action "login")}} - {{#d-modal-body title="login.title" class="login-modal"}} + {{#d-modal-body title="login.title" class=modalBodyClasses}} {{#if showLoginButtons}} {{login-buttons showLoginWithEmailLink=showLoginWithEmailLink diff --git a/app/assets/javascripts/discourse/templates/modal/login.hbs b/app/assets/javascripts/discourse/templates/modal/login.hbs index e8272134a9a..8a277d0ba96 100644 --- a/app/assets/javascripts/discourse/templates/modal/login.hbs +++ b/app/assets/javascripts/discourse/templates/modal/login.hbs @@ -1,5 +1,5 @@ {{#login-modal screenX=lastX screenY=lastY loginName=loginName loginPassword=loginPassword secondFactorToken=secondFactorToken action=(action "login")}} - {{#d-modal-body title="login.title" class=(concat "login-modal" " " (if hasAtLeastOneLoginButton "has-alt-auth"))}} + {{#d-modal-body title="login.title" class=modalBodyClasses}} {{#if canLoginLocal}}
diff --git a/app/assets/stylesheets/common/base/login.scss b/app/assets/stylesheets/common/base/login.scss index fa767cd394e..00beeeccd69 100644 --- a/app/assets/stylesheets/common/base/login.scss +++ b/app/assets/stylesheets/common/base/login.scss @@ -55,6 +55,9 @@ display: inline-flex; } } + &.awaiting-approval { + display: none; + } } .create-account {