mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
Do not clear password until after leaving signin
Closes #3399 - Provide our own authenticate action handler which does not clear the password input. - Use the Signin route's deactivate hook to clear the password property on the controller after the user has transitioned away from the signin page.
This commit is contained in:
parent
1cff73f36c
commit
9dfef70d25
2 changed files with 18 additions and 2 deletions
|
@ -1,11 +1,17 @@
|
||||||
import ValidationEngine from 'ghost/mixins/validation-engine';
|
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',
|
authenticator: 'simple-auth-authenticator:oauth2-password-grant',
|
||||||
|
|
||||||
validationType: 'signin',
|
validationType: 'signin',
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
authenticate: function () {
|
||||||
|
var data = this.getProperties('identification', 'password');
|
||||||
|
|
||||||
|
return this._super(data);
|
||||||
|
},
|
||||||
|
|
||||||
validateAndAuthenticate: function () {
|
validateAndAuthenticate: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,16 @@ var SigninRoute = Ember.Route.extend(styleBody, loadingIndicator, {
|
||||||
this.transitionTo(SimpleAuth.Configuration.routeAfterAuthentication);
|
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: {
|
actions: {
|
||||||
sessionAuthenticationFailed: function (error) {
|
sessionAuthenticationFailed: function (error) {
|
||||||
this.notifications.closePassive();
|
this.notifications.closePassive();
|
||||||
|
@ -39,4 +49,4 @@ var SigninRoute = Ember.Route.extend(styleBody, loadingIndicator, {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default SigninRoute;
|
export default SigninRoute;
|
||||||
|
|
Loading…
Reference in a new issue