-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
password-section.js
56 lines (54 loc) · 1.42 KB
/
password-section.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import Component from '@ember/component';
import FormMixin from 'open-event-frontend/mixins/form';
export default Component.extend(FormMixin, {
getValidationRules() {
return {
inline : true,
delay : false,
on : 'blur',
fields : {
currentPassword: {
identifier : 'password_current',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the current password')
}
]
},
newPassword: {
identifier : 'password_new',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter a new password')
},
{
type : 'minLength[8]',
prompt : this.l10n.t('Your password must have at least {ruleValue} characters')
}
]
},
repeatPassword: {
identifier : 'password_repeat',
rules : [
{
type : 'match[password_new]',
prompt : this.l10n.t('Passwords do not match')
}
]
}
}
};
},
actions: {
showPassword(fieldName) {
this.toggleProperty(`showPass${fieldName}`);
},
submit() {
this.onValid(() => {
this.changePassword({ passwordCurrent: this.passwordCurrent, passwordNew: this.passwordNew });
});
}
}
});