(
userId: number,
passwordHash: string,
disallowNPreviousPasswords: number,
)
| 235 | } |
| 236 | |
| 237 | async setPasswordHash( |
| 238 | userId: number, |
| 239 | passwordHash: string, |
| 240 | disallowNPreviousPasswords: number, |
| 241 | ): Promise<void> { |
| 242 | await this.activeUsers().where('id', userId).update({ |
| 243 | // @ts-expect-error password_hash does not exist in User type |
| 244 | password_hash: passwordHash, |
| 245 | }); |
| 246 | // We apparently set this to null, but you should be allowed to have null, so need to allow this |
| 247 | if (passwordHash) { |
| 248 | await this.db(PASSWORD_HASH_TABLE).insert({ |
| 249 | user_id: userId, |
| 250 | password_hash: passwordHash, |
| 251 | }); |
| 252 | await this.deletePasswordsUsedMoreThanNTimesAgo( |
| 253 | userId, |
| 254 | disallowNPreviousPasswords, |
| 255 | ); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | async incLoginAttempts(user: User): Promise<void> { |
| 260 | await this.buildSelectUser(user).increment('login_attempts', 1); |
nothing calls this directly
no test coverage detected