From e1c5503114deef954731904695cd40dccfcef555 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Apr 2020 11:36:50 +0200 Subject: Support logout and add id and pass tests --- server/models/account/user.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/models/account') 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 { export class UserModel extends Model { @AllowNull(true) - @Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password')) + @Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password', true)) @Column password: string @@ -388,7 +388,7 @@ export class UserModel extends Model { @BeforeCreate @BeforeUpdate static cryptPasswordIfNeeded (instance: UserModel) { - if (instance.changed('password')) { + if (instance.changed('password') && instance.password) { return cryptPassword(instance.password) .then(hash => { instance.password = hash -- cgit v1.2.3