mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
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'),
|
}.property('loginName', 'loginPassword', 'loggingIn'),
|
||||||
|
|
||||||
showSignupLink: function() {
|
showSignupLink: function() {
|
||||||
return !Discourse.SiteSettings.invite_only && !this.get('loggingIn');
|
return !Discourse.SiteSettings.invite_only && !this.get('loggingIn') && this.blank('authenticate');
|
||||||
}.property('loggingIn'),
|
}.property('loggingIn', 'authenticate'),
|
||||||
|
|
||||||
|
showSpinner: function() {
|
||||||
|
return this.get('loggingIn') || this.get('authenticate');
|
||||||
|
}.property('loggingIn', 'authenticate'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
login: function() {
|
login: function() {
|
||||||
|
@ -91,8 +95,15 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
|
||||||
|
|
||||||
var height = loginMethod.get("frameHeight") || 400;
|
var height = loginMethod.get("frameHeight") || 400;
|
||||||
var width = loginMethod.get("frameWidth") || 800;
|
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);
|
"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 id='login-alert' {{bindAttr class="alertClass"}}>{{alert}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
{{#if authenticate}}
|
|
||||||
{{i18n login.authenticating}}
|
|
||||||
{{/if}}
|
|
||||||
{{#if Discourse.SiteSettings.enable_local_logins}}
|
{{#if Discourse.SiteSettings.enable_local_logins}}
|
||||||
<button class='btn btn-large btn-primary'
|
<button class='btn btn-large btn-primary'
|
||||||
{{bindAttr disabled="loginDisabled"}}
|
{{bindAttr disabled="loginDisabled"}}
|
||||||
|
@ -57,9 +54,13 @@
|
||||||
{{i18n create_account.action}}
|
{{i18n create_account.action}}
|
||||||
</a>
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if loggingIn}}
|
{{#if authenticate}}
|
||||||
|
{{i18n login.authenticating}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if showSpinner}}
|
||||||
<i class='fa fa-spinner fa-spin'></i>
|
<i class='fa fa-spinner fa-spin'></i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user