Add spinner when authenticating with 3rd party. Also handle when popup window is closed without making a callback.
This commit is contained in:
parent
e732aa8a86
commit
bcfaf522fd
|
@ -37,8 +37,12 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
|
|||
}.property('loginName', 'loginPassword', 'loggingIn'),
|
||||
|
||||
showSignupLink: function() {
|
||||
return !Discourse.SiteSettings.invite_only && !this.get('loggingIn');
|
||||
}.property('loggingIn'),
|
||||
return !Discourse.SiteSettings.invite_only && !this.get('loggingIn') && this.blank('authenticate');
|
||||
}.property('loggingIn', 'authenticate'),
|
||||
|
||||
showSpinner: function() {
|
||||
return this.get('loggingIn') || this.get('authenticate');
|
||||
}.property('loggingIn', 'authenticate'),
|
||||
|
||||
actions: {
|
||||
login: function() {
|
||||
|
@ -91,8 +95,15 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
|
|||
|
||||
var height = loginMethod.get("frameHeight") || 400;
|
||||
var width = loginMethod.get("frameWidth") || 800;
|
||||
window.open(Discourse.getURL("/auth/" + name), "_blank",
|
||||
var w = window.open(Discourse.getURL("/auth/" + name), "_blank",
|
||||
"menubar=no,status=no,height=" + height + ",width=" + width + ",left=" + left + ",top=" + top);
|
||||
var self = this;
|
||||
var timer = setInterval(function() {
|
||||
if(w.closed) {
|
||||
clearInterval(timer);
|
||||
self.set('authenticate', null);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -41,9 +41,6 @@
|
|||
<div id='login-alert' {{bindAttr class="alertClass"}}>{{alert}}</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
{{#if authenticate}}
|
||||
{{i18n login.authenticating}}
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_local_logins}}
|
||||
<button class='btn btn-large btn-primary'
|
||||
{{bindAttr disabled="loginDisabled"}}
|
||||
|
@ -57,9 +54,13 @@
|
|||
{{i18n create_account.action}}
|
||||
</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if loggingIn}}
|
||||
<i class='fa fa-spinner fa-spin'></i>
|
||||
{{/if}}
|
||||
{{#if authenticate}}
|
||||
{{i18n login.authenticating}}
|
||||
{{/if}}
|
||||
|
||||
{{#if showSpinner}}
|
||||
<i class='fa fa-spinner fa-spin'></i>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue