FIX: dispatch correct modal on auto login

This commit is contained in:
Sam 2014-08-15 12:13:10 +10:00
parent 00c791b12e
commit e16dd96b6d
1 changed files with 5 additions and 5 deletions

View File

@ -32,7 +32,7 @@ var ApplicationRoute = Em.Route.extend({
var returnPath = encodeURIComponent(window.location.pathname); var returnPath = encodeURIComponent(window.location.pathname);
window.location = Discourse.getURL('/session/sso?return_path=' + returnPath); window.location = Discourse.getURL('/session/sso?return_path=' + returnPath);
} else { } else {
this.send('autoLogin', function(){ this.send('autoLogin', 'login', function(){
Discourse.Route.showModal(self, 'login'); Discourse.Route.showModal(self, 'login');
self.controllerFor('login').resetForm(); self.controllerFor('login').resetForm();
}); });
@ -43,17 +43,17 @@ var ApplicationRoute = Em.Route.extend({
showCreateAccount: function() { showCreateAccount: function() {
var self = this; var self = this;
self.send('autoLogin', function(){ self.send('autoLogin', 'createAccount', function(){
Discourse.Route.showModal(self, 'createAccount'); Discourse.Route.showModal(self, 'createAccount');
}); });
}, },
autoLogin: function(onFail){ autoLogin: function(modal, onFail){
var methods = Em.get('Discourse.LoginMethod.all'); var methods = Em.get('Discourse.LoginMethod.all');
if (!Discourse.SiteSettings.enable_local_logins && if (!Discourse.SiteSettings.enable_local_logins &&
methods.length === 1) { methods.length === 1) {
Discourse.Route.showModal(this, 'login'); Discourse.Route.showModal(this, modal);
this.controllerFor('login').send("externalLogin", methods[0]); this.controllerFor('login').send('externalLogin', methods[0]);
} else { } else {
onFail(); onFail();
} }