Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion app/components/forms/reset-password-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ export default Component.extend(FormMixin, {
{
type : 'empty',
prompt : this.l10n.t('Please enter your new password')
},
{
type : 'minLength[8]',
prompt : this.l10n.t('Your password must have at least {ruleValue} characters')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a field for confirmation of password .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

}
]
},
repeatPassword: {
identifier : 'password_repeat',
rules : [
{
type : 'match[password]',
prompt : this.l10n.t('Passwords do not match')
}
]
}
Expand All @@ -42,6 +55,13 @@ export default Component.extend(FormMixin, {
},

actions: {
showNewPassword() {
this.toggleProperty('showNewPass');
},

showRepeatPassword() {
this.toggleProperty('showRepeatPass');
},
submit() {
this.onValid(() => {
let payload = {};
Expand Down Expand Up @@ -109,4 +129,4 @@ export default Component.extend(FormMixin, {
this.set('session.newUser', null);
}
}
});
});
43 changes: 41 additions & 2 deletions app/templates/components/forms/reset-password-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,46 @@
{{#if token}}
<div class="ui left icon input">
<i class="key icon"></i>
{{input type='password' name='password' placeholder=(t 'password') value=password}}
{{#if showNewPass}}
{{input type='text' name='password' placeholder=(t 'New Password') value=password}}
{{else}}
{{input type='password' name='password' placeholder=(t 'New Password') value=password}}
{{/if}}
<div class="ui small basic icon buttons">
<button type="button" class="ui button" {{action 'showNewPassword'}}>
{{#if showNewPass}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of duplication in here. Please reduce it and make the code optimal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then there will be no space in between both the textfields, thats why repeated the else part

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ezgif com-video-to-gif (1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is implemented similar to that in sign up part

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goal is to improve the code as we move on. "It was implemented this way" doesn't really work

Remove duplication as much as possible

<i class="hide basic icon"></i>
{{else}}
<i class="unhide basic icon"></i>
{{/if}}
</button>
</div>
</div>
{{else}}
<div class="ui left icon input">
<i class="mail icon"></i>
{{input name='email' placeholder=(t 'Email ID') value=identification}}
</div>
{{/if}}
</div>
<div class="field">
{{#if token}}
<div class="ui left icon input">
<i class="key icon"></i>
{{#if showRepeatPass}}
{{input type='text' name='password_repeat' placeholder=(t 'Confirm Password') value=password_repeat}}
{{else}}
{{input type='password' name='password_repeat' placeholder=(t 'Confirm Password') value=password_repeat}}
{{/if}}
<div class="ui small basic icon buttons">
<button type="button" class="ui button" {{action 'showRepeatPassword'}}>
{{#if showRepeatPass}}
<i class="hide basic icon"></i>
{{else}}
<i class="unhide basic icon"></i>
{{/if}}
</button>
</div>
</div>
{{else}}
<div class="ui left icon input">
Expand All @@ -41,4 +80,4 @@
</div>
</form>
</div>
</div>
</div>