blob: 6187333c9e65b4fce7aae27253d5104472dbaae7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
define([
'components/common/modal-form',
'./templates'
], function (ModalForm) {
return ModalForm.extend({
template: Templates['users-change-password'],
onFormSubmit: function (e) {
this._super(e);
this.sendRequest();
},
sendRequest: function () {
var that = this,
password = this.$('#change-user-password-password').val(),
confirmation = this.$('#change-user-password-password-confirmation').val();
if (password !== confirmation) {
that.showErrors([{ msg: 'New password and its confirmation do not match' }]);
return;
}
this.disableForm();
return this.model.changePassword(password, {
statusCode: {
// do not show global error
400: null
}
}).done(function () {
that.close();
}).fail(function (jqXHR) {
that.enableForm();
that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
});
}
});
});
|