Adding classes to login for external auth and user fields (#6535)

This commit is contained in:
Kris 2018-10-26 10:33:06 -04:00 committed by GitHub
parent b2585524a9
commit 7c2618e914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import UsernameValidation from "discourse/mixins/username-validation";
import NameValidation from "discourse/mixins/name-validation";
import UserFieldsValidation from "discourse/mixins/user-fields-validation";
import { userPath } from "discourse/lib/url";
import { findAll } from "discourse/models/login-method";
export default Ember.Controller.extend(
ModalFunctionality,
@ -176,6 +177,11 @@ export default Ember.Controller.extend(
}
}.observes("emailValidation", "accountEmail"),
// Determines whether at least one login button is enabled
hasAtLeastOneLoginButton: function() {
return findAll(this.siteSettings).length > 0;
}.property(),
@on("init")
fetchConfirmationValue() {
return ajax(userPath("hp.json")).then(json => {

View File

@ -57,9 +57,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
},
// Determines whether at least one login button is enabled
hasAtLeastOneLoginButton: function() {
return findAll(this.siteSettings).length > 0;
}.property(),
@computed("canLoginLocalWithEmail")
hasAtLeastOneLoginButton(canLoginLocalWithEmail) {
return findAll(this.siteSettings).length > 0 || canLoginLocalWithEmail;
},
@computed("loggingIn")
loginButtonLabel(loggingIn) {

View File

@ -1,6 +1,6 @@
{{#create-account email=accountEmail disabled=submitDisabled action="createAccount"}}
{{#unless complete}}
{{#d-modal-body title="create_account.title"}}
{{#d-modal-body title="create_account.title" class=(concat (if hasAtLeastOneLoginButton "has-alt-auth") " " (if userFields "has-user-fields"))}}
{{#unless hasAuthOptions}}
{{login-buttons externalLogin="externalLogin"}}

View File

@ -1,5 +1,5 @@
{{#login-modal screenX=lastX screenY=lastY loginName=loginName loginPassword=loginPassword loginSecondFactor=loginSecondFactor action="login"}}
{{#d-modal-body title="login.title" class="login-modal"}}
{{#d-modal-body title="login.title" class=(concat "login-modal" " " (if hasAtLeastOneLoginButton "has-alt-auth"))}}
{{#if canLoginLocal}}
<form id='login-form' method='post'>