Add network protection and administrator account support

This commit is contained in:
2026-10-15 12:05:52 +09:00
parent 471e2653d8
commit 4d527f74e6
20 changed files with 2913 additions and 106 deletions

View File

@@ -231,10 +231,16 @@ export class Auth {
const valid = await argon2
.verify(user?.passwordHash ?? (await dummy), password)
.catch(() => false);
if (!valid || !user || !['pending', 'active'].includes(user.status))
const currentUser = user ? this.user(user.id) : null;
if (
!valid ||
!currentUser ||
!['pending', 'active'].includes(currentUser.status) ||
currentUser.passwordHash !== user?.passwordHash
)
fail(401, 'LOGIN_FAILED', '이메일 또는 비밀번호를 확인해 주세요.');
const previous = this.session(oldToken);
const result = this.createSession(user!, oldToken);
const result = this.createSession(currentUser!, oldToken);
if (previous) this.endSession(previous);
return result;
}