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

View File

@ -1,6 +1,6 @@
{{#create-account email=accountEmail disabled=submitDisabled action="createAccount"}} {{#create-account email=accountEmail disabled=submitDisabled action="createAccount"}}
{{#unless complete}} {{#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}} {{#unless hasAuthOptions}}
{{login-buttons externalLogin="externalLogin"}} {{login-buttons externalLogin="externalLogin"}}

View File

@ -1,5 +1,5 @@
{{#login-modal screenX=lastX screenY=lastY loginName=loginName loginPassword=loginPassword loginSecondFactor=loginSecondFactor action="login"}} {{#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}} {{#if canLoginLocal}}
<form id='login-form' method='post'> <form id='login-form' method='post'>