cleaner login modal when there is no login button [fixes #638]
This commit is contained in:
parent
5beaf61ac0
commit
aca7fa01bb
|
@ -1,27 +1,27 @@
|
|||
<div class="modal-body">
|
||||
<div id="login-buttons">
|
||||
{{#if Discourse.SiteSettings.enable_google_logins}}
|
||||
<button class="btn btn-social google" title="{{i18n login.google.title}}" {{action openidLogin "google" target="view"}}>{{i18n login.google.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_facebook_logins}}
|
||||
<button class="btn btn-social facebook" title="{{i18n login.facebook.title}}" {{action "facebookLogin" target="view"}}>{{i18n login.facebook.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_twitter_logins}}
|
||||
<button class="btn btn-social twitter" title="{{i18n login.twitter.title}}" {{action "twitterLogin" target="view"}}>{{i18n login.twitter.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_yahoo_logins}}
|
||||
<button class="btn btn-social yahoo" title="{{i18n login.yahoo.title}}" {{action openidLogin "yahoo" target="view"}}>{{i18n login.yahoo.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_github_logins}}
|
||||
<button class="btn btn-social github" title="{{i18n login.github.title}}" {{action "githubLogin" target="view"}}>{{i18n login.github.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_persona_logins}}
|
||||
<button class="btn btn-social persona" title="{{i18n login.persona.title}}" {{action "personaLogin" target="view"}}>{{i18n login.persona.title}}</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
<h3 style="text-align:center; margin-bottom:10px;">
|
||||
{{i18n login.or}}
|
||||
</h3>
|
||||
{{#if view.hasAtLeastOneLoginButton}}
|
||||
<div id="login-buttons">
|
||||
{{#if Discourse.SiteSettings.enable_google_logins}}
|
||||
<button class="btn btn-social google" title="{{i18n login.google.title}}" {{action openidLogin "google" target="view"}}>{{i18n login.google.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_facebook_logins}}
|
||||
<button class="btn btn-social facebook" title="{{i18n login.facebook.title}}" {{action "facebookLogin" target="view"}}>{{i18n login.facebook.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_twitter_logins}}
|
||||
<button class="btn btn-social twitter" title="{{i18n login.twitter.title}}" {{action "twitterLogin" target="view"}}>{{i18n login.twitter.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_yahoo_logins}}
|
||||
<button class="btn btn-social yahoo" title="{{i18n login.yahoo.title}}" {{action openidLogin "yahoo" target="view"}}>{{i18n login.yahoo.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_github_logins}}
|
||||
<button class="btn btn-social github" title="{{i18n login.github.title}}" {{action "githubLogin" target="view"}}>{{i18n login.github.title}}</button>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_persona_logins}}
|
||||
<button class="btn btn-social persona" title="{{i18n login.persona.title}}" {{action "personaLogin" target="view"}}>{{i18n login.persona.title}}</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
<h3 style="text-align:center; margin-bottom:10px;">{{i18n login.or}}</h3>
|
||||
{{/if}}
|
||||
<form id='login-form'>
|
||||
<div>
|
||||
<table>
|
||||
|
|
|
@ -25,22 +25,25 @@ Discourse.LoginView = Discourse.ModalBodyView.extend({
|
|||
return this.showView(Discourse.ForgotPasswordView.create());
|
||||
},
|
||||
|
||||
loginButtonText: (function() {
|
||||
if (this.get('loggingIn')) {
|
||||
return Em.String.i18n('login.logging_in');
|
||||
}
|
||||
return Em.String.i18n('login.title');
|
||||
}).property('loggingIn'),
|
||||
/**
|
||||
Determines whether at least one login button is enabled
|
||||
**/
|
||||
hasAtLeastOneLoginButton: function() {
|
||||
return Discourse.SiteSettings.enable_google_logins ||
|
||||
Discourse.SiteSettings.enable_facebook_logins ||
|
||||
Discourse.SiteSettings.enable_twitter_logins ||
|
||||
Discourse.SiteSettings.enable_yahoo_logins ||
|
||||
Discourse.SiteSettings.enable_github_logins ||
|
||||
Discourse.SiteSettings.enable_persona_logins;
|
||||
}.property(),
|
||||
|
||||
loginDisabled: (function() {
|
||||
if (this.get('loggingIn')) {
|
||||
return true;
|
||||
}
|
||||
if (this.blank('loginName') || this.blank('loginPassword')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).property('loginName', 'loginPassword', 'loggingIn'),
|
||||
loginButtonText: function() {
|
||||
return this.get('loggingIn') ? Em.String.i18n('login.logging_in') : Em.String.i18n('login.title');
|
||||
}.property('loggingIn'),
|
||||
|
||||
loginDisabled: function() {
|
||||
return this.get('loggingIn') || this.blank('loginName') || this.blank('loginPassword');
|
||||
}.property('loginName', 'loginPassword', 'loggingIn'),
|
||||
|
||||
login: function() {
|
||||
this.set('loggingIn', true);
|
||||
|
@ -50,7 +53,6 @@ Discourse.LoginView = Discourse.ModalBodyView.extend({
|
|||
data: { login: this.get('loginName'), password: this.get('loginPassword') },
|
||||
type: 'POST'
|
||||
}).then(function (result) {
|
||||
|
||||
// Successful login
|
||||
if (result.error) {
|
||||
loginView.set('loggingIn', false);
|
||||
|
|
Loading…
Reference in New Issue