|
|
@ -185,8 +185,13 @@ var bcrypt = require('bcryptjs'),
|
|
|
|
return callback(err);
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data && data.password) {
|
|
|
|
if (data) {
|
|
|
|
|
|
|
|
if (data.password) {
|
|
|
|
delete data.password;
|
|
|
|
delete data.password;
|
|
|
|
|
|
|
|
data.hasPassword = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
data.hasPassword = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
callback(err, data);
|
|
|
|
callback(err, data);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -467,6 +472,7 @@ var bcrypt = require('bcryptjs'),
|
|
|
|
return callback(err);
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currentPassword !== null) {
|
|
|
|
bcrypt.compare(data.currentPassword, currentPassword, function(err, res) {
|
|
|
|
bcrypt.compare(data.currentPassword, currentPassword, function(err, res) {
|
|
|
|
if (err || !res) {
|
|
|
|
if (err || !res) {
|
|
|
|
return callback(err || new Error('Your current password is not correct!'));
|
|
|
|
return callback(err || new Error('Your current password is not correct!'));
|
|
|
@ -474,6 +480,10 @@ var bcrypt = require('bcryptjs'),
|
|
|
|
|
|
|
|
|
|
|
|
hashAndSetPassword(callback);
|
|
|
|
hashAndSetPassword(callback);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// No password in account (probably SSO login)
|
|
|
|
|
|
|
|
hashAndSetPassword(callback);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|