X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Fuser.ts;h=260c1b28eba443921817f28a31ab01cb17b4aef6;hb=8bb71f2e332726c207318e44b95e784f9740dc40;hp=da40bf290ad43e87b870607d3e93a5f60d8fcd25;hpb=5600def4c87d3e6b7724489c9c4415778ea014d3;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/user.ts b/server/models/account/user.ts index da40bf290..260c1b28e 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts @@ -221,8 +221,8 @@ enum ScopeNames { }) export class UserModel extends Model { - @AllowNull(false) - @Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password')) + @AllowNull(true) + @Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password', true)) @Column password: string @@ -348,6 +348,11 @@ export class UserModel extends Model { @Column noWelcomeModal: boolean + @AllowNull(true) + @Default(null) + @Column + pluginAuth: string + @CreatedAt createdAt: Date @@ -383,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 @@ -801,7 +806,9 @@ export class UserModel extends Model { videoChannels: [], - createdAt: this.createdAt + createdAt: this.createdAt, + + pluginAuth: this.pluginAuth } if (parameters.withAdminFlags) {