diff --git a/core/client/controllers/signin.js b/core/client/controllers/signin.js index 295a92681f..d7b6967f0a 100644 --- a/core/client/controllers/signin.js +++ b/core/client/controllers/signin.js @@ -16,6 +16,7 @@ var SigninController = Ember.Controller.extend(SimpleAuth.AuthenticationControll var self = this; this.validate({ format: false }).then(function () { + self.notifications.closePassive(); self.send('authenticate'); }).catch(function (errors) { self.notifications.closePassive(); diff --git a/core/client/routes/application.js b/core/client/routes/application.js index 00904d5927..82cf0828db 100644 --- a/core/client/routes/application.js +++ b/core/client/routes/application.js @@ -24,6 +24,34 @@ var ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, Shor this.send('loadServerNotifications', true); }, + sessionAuthenticationFailed: function (error) { + this.notifications.closePassive(); + this.notifications.showError(error.message); + }, + + sessionAuthenticationSucceeded: function () { + var self = this; + this.store.find('user', 'me').then(function (user) { + self.send('signedIn', user); + var attemptedTransition = self.get('session').get('attemptedTransition'); + if (attemptedTransition) { + attemptedTransition.retry(); + self.get('session').set('attemptedTransition', null); + } else { + self.transitionTo(SimpleAuth.Configuration.routeAfterAuthentication); + } + }); + }, + + sessionInvalidationFailed: function (error) { + this.notifications.closePassive(); + this.notifications.showError(error.message); + }, + + sessionInvalidationSucceeded: function () { + this.notifications.showSuccess('You were successfully signed out.', true); + }, + openModal: function (modalName, model, type) { modalName = 'modals/' + modalName; // We don't always require a modal to have a controller diff --git a/core/client/routes/signin.js b/core/client/routes/signin.js index 5aecda83f5..8de9719c39 100644 --- a/core/client/routes/signin.js +++ b/core/client/routes/signin.js @@ -13,40 +13,10 @@ var SigninRoute = Ember.Route.extend(styleBody, loadingIndicator, { deactivate: function () { this._super(); - // clear the password property from the controller when we're no longer - // on the signin screen - this.controllerFor('signin').set('password', ''); - }, - - actions: { - sessionAuthenticationFailed: function (error) { - this.notifications.closePassive(); - this.notifications.showError(error.message); - }, - sessionAuthenticationSucceeded: function () { - var self = this; - this.store.find('user', 'me').then(function (user) { - self.send('signedIn', user); - var attemptedTransition = self.get('session').get('attemptedTransition'); - if (attemptedTransition) { - attemptedTransition.retry(); - self.get('session').set('attemptedTransition', null); - } else { - self.transitionTo(SimpleAuth.Configuration.routeAfterAuthentication); - } - }); - }, - sessionInvalidationFailed: function (error) { - this.notifications.closePassive(); - this.notifications.showError(error.message); - }, - sessionInvalidationSucceeded: function () { - this.notifications.showSuccess('You were successfully signed out.', true); - this.send('signedOut'); - } + // clear the properties that hold the credentials from the controller + // when we're no longer on the signin screen + this.controllerFor('signin').setProperties({ identification: '', password: '' }); } - - }); export default SigninRoute; diff --git a/core/client/routes/signout.js b/core/client/routes/signout.js index f6ed18472d..8854bfcb91 100644 --- a/core/client/routes/signout.js +++ b/core/client/routes/signout.js @@ -4,13 +4,14 @@ import loadingIndicator from 'ghost/mixins/loading-indicator'; var SignoutRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, styleBody, loadingIndicator, { classNames: ['ghost-signout'], - afterModel: function (resolvedModel, transition) { + afterModel: function (model, transition) { if (Ember.canInvoke(transition, 'send')) { transition.send('invalidateSession'); transition.abort(); this.transitionTo('signin'); } else { this.send('invalidateSession'); + this.transitionTo('signin'); } } }); diff --git a/core/client/templates/-navbar.hbs b/core/client/templates/-navbar.hbs index f3424a5d50..4b2c87c393 100644 --- a/core/client/templates/-navbar.hbs +++ b/core/client/templates/-navbar.hbs @@ -24,7 +24,7 @@