diff options
Diffstat (limited to 'server/models/account')
-rw-r--r-- | server/models/account/user.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index d0d9a0508..1bff955df 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -222,7 +222,7 @@ enum ScopeNames { | |||
222 | export class UserModel extends Model<UserModel> { | 222 | export class UserModel extends Model<UserModel> { |
223 | 223 | ||
224 | @AllowNull(true) | 224 | @AllowNull(true) |
225 | @Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password')) | 225 | @Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password', true)) |
226 | @Column | 226 | @Column |
227 | password: string | 227 | password: string |
228 | 228 | ||
@@ -388,7 +388,7 @@ export class UserModel extends Model<UserModel> { | |||
388 | @BeforeCreate | 388 | @BeforeCreate |
389 | @BeforeUpdate | 389 | @BeforeUpdate |
390 | static cryptPasswordIfNeeded (instance: UserModel) { | 390 | static cryptPasswordIfNeeded (instance: UserModel) { |
391 | if (instance.changed('password')) { | 391 | if (instance.changed('password') && instance.password) { |
392 | return cryptPassword(instance.password) | 392 | return cryptPassword(instance.password) |
393 | .then(hash => { | 393 | .then(hash => { |
394 | instance.password = hash | 394 | instance.password = hash |