UX: add awaiting-approval class to login modal

when local logins are disabled and account is awaiting approval
This commit is contained in:
Maja Komel 2019-04-01 15:14:27 +02:00
parent c10861da2f
commit d32aaf374e
4 changed files with 24 additions and 3 deletions

View File

@ -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({

View File

@ -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

View File

@ -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}}
<form id='login-form' method='post'>

View File

@ -55,6 +55,9 @@
display: inline-flex;
}
}
&.awaiting-approval {
display: none;
}
}
.create-account {