aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/user.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-23 11:36:50 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commite1c5503114deef954731904695cd40dccfcef555 (patch)
tree72cec4ee691a3362a7d024dc830d215a6b2c800a /server/models/account/user.ts
parent8dc8a34ee8428e7657414115d1c137592efa174d (diff)
downloadPeerTube-e1c5503114deef954731904695cd40dccfcef555.tar.gz
PeerTube-e1c5503114deef954731904695cd40dccfcef555.tar.zst
PeerTube-e1c5503114deef954731904695cd40dccfcef555.zip
Support logout and add id and pass tests
Diffstat (limited to 'server/models/account/user.ts')
-rw-r--r--server/models/account/user.ts4
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 {
222export class UserModel extends Model<UserModel> { 222export 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