mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
b6a429ec35
Closes #2976, Closes #3017 - Move logic to signup controller - Add ValidationEngine mixin to signup controller - Add signup validator with code from clientold login view - Add signin validator and integrate into signin controller - Add validation to forgotten controller - Switch to button action to support hitting enter in text field to submit - Clear all notifications in notifications.closeAll - Modify ValidationEngine.validate to not format errors based on option - Update casper test for signin to wait for notification before trying to do another signin
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
import ValidationEngine from 'ghost/mixins/validation-engine';
|
|
|
|
var ForgottenController = Ember.Controller.extend(ValidationEngine, {
|
|
email: '',
|
|
submitting: false,
|
|
|
|
// ValidationEngine settings
|
|
validationType: 'forgotten',
|
|
|
|
actions: {
|
|
submit: function () {
|
|
var self = this;
|
|
|
|
this.toggleProperty('submitting');
|
|
this.validate({ format: false }).then(function () {
|
|
self.user.fetchForgottenPasswordFor(this.email)
|
|
.then(function () {
|
|
self.toggleProperty('submitting');
|
|
self.notifications.showSuccess('Please check your email for instructions.');
|
|
self.transitionToRoute('signin');
|
|
})
|
|
.catch(function (resp) {
|
|
self.toggleProperty('submitting');
|
|
self.notifications.showAPIError(resp, 'There was a problem logging in, please try again.');
|
|
});
|
|
}).catch(function (errors) {
|
|
self.toggleProperty('submitting');
|
|
self.notifications.showErrors(errors);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
export default ForgottenController;
|