UX: add awaiting-approval class to login modal
when local logins are disabled and account is awaiting approval
This commit is contained in:
parent
c10861da2f
commit
d32aaf374e
|
@ -29,6 +29,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
processingEmailLink: false,
|
processingEmailLink: false,
|
||||||
showLoginButtons: true,
|
showLoginButtons: true,
|
||||||
showSecondFactor: false,
|
showSecondFactor: false,
|
||||||
|
awaitingApproval: false,
|
||||||
|
|
||||||
canLoginLocal: setting("enable_local_logins"),
|
canLoginLocal: setting("enable_local_logins"),
|
||||||
canLoginLocalWithEmail: setting("enable_local_logins_via_email"),
|
canLoginLocalWithEmail: setting("enable_local_logins_via_email"),
|
||||||
|
@ -42,7 +43,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
loggedIn: false,
|
loggedIn: false,
|
||||||
secondFactorRequired: false,
|
secondFactorRequired: false,
|
||||||
showSecondFactor: false,
|
showSecondFactor: false,
|
||||||
showLoginButtons: true
|
showLoginButtons: true,
|
||||||
|
awaitingApproval: false
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -56,6 +58,14 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
return showSecondFactor ? "" : "hidden";
|
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
|
// Determines whether at least one login button is enabled
|
||||||
@computed("canLoginLocalWithEmail")
|
@computed("canLoginLocalWithEmail")
|
||||||
hasAtLeastOneLoginButton(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) {
|
if (options.omniauth_disallow_totp) {
|
||||||
return loginError(I18n.t("login.omniauth_disallow_totp"), "error", () => {
|
return loginError(I18n.t("login.omniauth_disallow_totp"), "error", () => {
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{#login-modal screenX=lastX screenY=lastY loginName=loginName loginPassword=loginPassword secondFactorToken=secondFactorToken action=(action "login")}}
|
{{#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}}
|
{{#if showLoginButtons}}
|
||||||
{{login-buttons
|
{{login-buttons
|
||||||
showLoginWithEmailLink=showLoginWithEmailLink
|
showLoginWithEmailLink=showLoginWithEmailLink
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{#login-modal screenX=lastX screenY=lastY loginName=loginName loginPassword=loginPassword secondFactorToken=secondFactorToken action=(action "login")}}
|
{{#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}}
|
{{#if canLoginLocal}}
|
||||||
<form id='login-form' method='post'>
|
<form id='login-form' method='post'>
|
||||||
|
|
|
@ -55,6 +55,9 @@
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.awaiting-approval {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.create-account {
|
.create-account {
|
||||||
|
|
Loading…
Reference in New Issue