1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 15:19:42 +02:00

Fix password reset problem

This commit is contained in:
zinyando 2016-07-27 10:17:27 +02:00
parent a66fc70ab3
commit ab76137f5c
3 changed files with 20 additions and 35 deletions

View file

@ -3,6 +3,9 @@ import Ember from 'ember';
const {
isEmpty,
isEqual,
isPresent,
computed,
set
} = Ember;
@ -12,7 +15,8 @@ export default Ember.Component.extend({
mustMatch: false,
passwordEmpty: computed('passwordError', {
get() {
if (this.get('passwordError')) {
let error = this.get('passwordError');
if (isPresent(error)) {
return `error`;
}
@ -21,7 +25,8 @@ export default Ember.Component.extend({
}),
confirmEmpty: computed('passwordConfirmError', {
get() {
if (this.get('passwordConfirmError')) {
let error = this.get('passwordConfirmError');
if (isPresent(error)) {
return `error`;
}
@ -35,23 +40,23 @@ export default Ember.Component.extend({
let passwordConfirm = this.get('passwordConfirm');
if (isEmpty(password)) {
Ember.set(this, 'passwordError', true);
set(this, 'passwordError', "error");
return $("#newPassword").focus();
}
if (isEmpty(passwordConfirm)) {
Ember.set(this, 'passwordConfirmError', true);
set(this, 'passwordConfirmError', "error");
return $("#passwordConfirm").focus();
}
if (!isEqual(password, passwordConfirm)) {
$("#newPassword").addClass("error").focus();
$("#passwordConfirm").addClass("error");
this.set('mustMatch', true);
set(this, 'passwordError', "error");
set(this, 'passwordConfirmError', "error");
set(this, 'mustMatch', true);
return;
}
this.get('reset')();
this.get('reset')(password);
}
}
});