Skip to content

Commit 658b9ae

Browse files
committed
feat: better repeat-password-form
1 parent fc3afa4 commit 658b9ae

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

app/components/forms/reset-password-form.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ export default Component.extend(FormMixin, {
3434
{
3535
type : 'empty',
3636
prompt : this.l10n.t('Please enter your new password')
37+
},
38+
{
39+
type : 'minLength[8]',
40+
prompt : this.l10n.t('Your password must have at least {ruleValue} characters')
41+
}
42+
]
43+
},
44+
45+
passwordRepeat: {
46+
identifier : 'password_repeat',
47+
rules : [
48+
{
49+
type : 'match[password]',
50+
prompt : this.l10n.t('Passwords do not match')
3751
}
3852
]
3953
}
@@ -42,6 +56,15 @@ export default Component.extend(FormMixin, {
4256
},
4357

4458
actions: {
59+
60+
showNewPassword() {
61+
this.toggleProperty('showNewPass');
62+
},
63+
64+
showConfirmPassword() {
65+
this.toggleProperty('showConfirmPass');
66+
},
67+
4568
submit() {
4669
this.onValid(() => {
4770
let payload = {};

app/templates/components/forms/reset-password-form.hbs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,23 @@
1919
<div class="field">
2020
{{#if token}}
2121
<div class="ui left icon input">
22-
<i class="key icon"></i>
23-
{{input type='password' name='password' placeholder=(t 'password') value=password}}
22+
<i class="lock icon"></i>
23+
{{input type=(if showNewPass 'text' 'password') name='password' placeholder=(t 'Password') value=password}}
24+
<div class="ui small basic icon buttons">
25+
<button class="ui button" id="eye2" {{ action 'showNewPassword'}}>
26+
<i class="{{if showNewPass 'hide' 'unhide'}} basic icon"></i>
27+
</button>
28+
</div>
29+
</div>
30+
<div class="ui hidden divider"></div>
31+
<div class="ui left icon input">
32+
<i class="lock icon"></i>
33+
{{input type=(if showConfirmPass 'text' 'password') name='password_repeat' placeholder=(t 'Confirm Password')}}
34+
<div class="ui small basic icon buttons">
35+
<button class="ui button" id="eye2" {{ action 'showConfirmPassword'}}>
36+
<i class="{{if showConfirmPass 'hide' 'unhide'}} basic icon"></i>
37+
</button>
38+
</div>
2439
</div>
2540
{{else}}
2641
<div class="ui left icon input">

0 commit comments

Comments
 (0)