})
export class UserModel extends Model<UserModel> {
- @AllowNull(false)
- @Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password'))
+ @AllowNull(true)
+ @Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password', true))
@Column
password: string
@Column
noWelcomeModal: boolean
+ @AllowNull(true)
+ @Default(null)
+ @Column
+ pluginAuth: string
+
@CreatedAt
createdAt: Date
@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
videoChannels: [],
- createdAt: this.createdAt
+ createdAt: this.createdAt,
+
+ pluginAuth: this.pluginAuth
}
if (parameters.withAdminFlags) {