Skip to content

Commit cd30bf3

Browse files
committed
feat(server): enforce password 8-128 characters long
1 parent 579e773 commit cd30bf3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: templates/app/server/api/user(auth)/user.model(mongooseModels).js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ UserSchema
9292
if(authTypes.indexOf(this.provider) !== -1) {
9393
return true;
9494
}<% } %>
95-
return password.length;
95+
return password.length >= 8 && password.length <= 128;
9696
}, 'Password cannot be blank');
9797

9898
// Validate email is not taken

Diff for: templates/app/server/api/user(auth)/user.model(sequelizeModels).js

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ export default function(sequelize, DataTypes) {
3333
password: {
3434
type: DataTypes.STRING,
3535
validate: {
36-
notEmpty: true
36+
notEmpty: true,
37+
min: 8,
38+
max: 128,
3739
}
3840
},
3941
provider: DataTypes.STRING,

0 commit comments

Comments
 (0)