Ghost/ghost/admin/controllers/reset.js
Peter Szel 3a72c3ca02 Created ResetController.
closes #2412

- Updated the reset route to accept token parameter and hand it over to the controller.
- Added ResetController which handles the submit action and the button disabled state.
- Added reset action to the user model to handle ajax request.
- Updated reset template.
- Added fixtures to test reset API action.
- Fixed password variable names to camel cased style (e.g. newpassword -> newPassword).
2014-03-31 13:06:28 +02:00

31 lines
936 B
JavaScript

/*global alert, console */
var ResetController = Ember.Controller.extend({
passwords: {
newPassword: '',
ne2Password: ''
},
token: '',
submitButtonDisabled: false,
actions: {
submit: function () {
var self = this;
this.set('submitButtonDisabled', true);
this.user.resetPassword(this.passwords, this.token)
.then(function () {
alert('@TODO Notification : Success');
self.transitionToRoute('signin');
})
.catch(function (response) {
alert('@TODO Notification : Failure');
console.log(response);
})
.finally(function () {
self.set('submitButtonDisabled', false);
});
}
}
});
export default ResetController;