move handling of password change in profile to client

This commit is contained in:
cleverbeagle 2017-07-31 10:37:11 -05:00
parent 242ea4914b
commit e8c221a8c0
3 changed files with 12 additions and 16 deletions

View file

@ -92,8 +92,6 @@ class Profile extends React.Component {
},
};
if (this.newPassword.value) profile.password = Accounts._hashPassword(this.newPassword.value);
Meteor.call('users.editProfile', profile, (error) => {
if (error) {
Bert.alert(error.reason, 'danger');
@ -101,6 +99,17 @@ class Profile extends React.Component {
Bert.alert('Profile updated!', 'success');
}
});
if (this.newPassword.value) {
Accounts.changePassword(this.currentPassword.value, this.newPassword.value, (error) => {
if (error) {
Bert.alert(error.reason, 'danger');
} else {
this.currentPassword.value = '';
this.newPassword.value = '';
}
});
}
}
renderOAuthUser(loading, user) {