Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #967 from mleanos/user-model-validate-bug
Browse files Browse the repository at this point in the history
[bug] Solves User model validation issue with tests [fixes #966]
  • Loading branch information
lirantal committed Oct 10, 2015
2 parents 9c78c63 + 288f0b4 commit 19aea2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/users/server/models/user.server.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ UserSchema.pre('save', function (next) {
* Hook a pre validate method to test the local password
*/
UserSchema.pre('validate', function (next) {
if (this.provider === 'local' && this.password) {
if (this.provider === 'local' && this.password && this.isModified('password')) {
var result = owasp.test(this.password);
if (result.errors.length) {
var error = result.errors.join(' ');
Expand Down

0 comments on commit 19aea2f

Please sign in to comment.