diff --git a/ghost/admin/controllers/signin.js b/ghost/admin/controllers/signin.js index 65f549f817..295a92681f 100644 --- a/ghost/admin/controllers/signin.js +++ b/ghost/admin/controllers/signin.js @@ -1,11 +1,17 @@ import ValidationEngine from 'ghost/mixins/validation-engine'; -var SigninController = Ember.Controller.extend(SimpleAuth.LoginControllerMixin, ValidationEngine, { +var SigninController = Ember.Controller.extend(SimpleAuth.AuthenticationControllerMixin, ValidationEngine, { authenticator: 'simple-auth-authenticator:oauth2-password-grant', validationType: 'signin', actions: { + authenticate: function () { + var data = this.getProperties('identification', 'password'); + + return this._super(data); + }, + validateAndAuthenticate: function () { var self = this; diff --git a/ghost/admin/routes/signin.js b/ghost/admin/routes/signin.js index 87e6691628..5aecda83f5 100644 --- a/ghost/admin/routes/signin.js +++ b/ghost/admin/routes/signin.js @@ -8,6 +8,16 @@ var SigninRoute = Ember.Route.extend(styleBody, loadingIndicator, { this.transitionTo(SimpleAuth.Configuration.routeAfterAuthentication); } }, + + // the deactivate hook is called after a route has been exited. + 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(); @@ -39,4 +49,4 @@ var SigninRoute = Ember.Route.extend(styleBody, loadingIndicator, { }); -export default SigninRoute; \ No newline at end of file +export default SigninRoute;