diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-23 11:36:50 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-05-04 16:21:39 +0200 |
commit | e1c5503114deef954731904695cd40dccfcef555 (patch) | |
tree | 72cec4ee691a3362a7d024dc830d215a6b2c800a /server/models/account | |
parent | 8dc8a34ee8428e7657414115d1c137592efa174d (diff) | |
download | PeerTube-e1c5503114deef954731904695cd40dccfcef555.tar.gz PeerTube-e1c5503114deef954731904695cd40dccfcef555.tar.zst PeerTube-e1c5503114deef954731904695cd40dccfcef555.zip |
Support logout and add id and pass tests
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 |