사요자 대시보드 추가
This commit is contained in:
@@ -66,7 +66,7 @@ async def request_login(payload: LoginRequest, request: Request):
|
||||
subject, html = security_alert_email(email, failures)
|
||||
send_email_background(ADMIN_EMAIL, subject, html)
|
||||
raise HTTPException(status_code=401, detail="이메일 또는 비밀번호가 올바르지 않습니다.")
|
||||
if user["status"] not in ("ACTIVE", "NO_COMPANY"):
|
||||
if user["status"] not in ("ACTIVE", "NO_COMPANY", "PENDING"):
|
||||
await record_login(user["id"], email, "FAILURE", "ACCOUNT_INACTIVE", agent)
|
||||
raise HTTPException(status_code=403, detail="활성화되지 않은 계정입니다.")
|
||||
|
||||
@@ -87,6 +87,17 @@ async def request_login(payload: LoginRequest, request: Request):
|
||||
async def _finish_login(user: dict, agent: str) -> JSONResponse:
|
||||
await clear_login_failures(user["id"])
|
||||
await trust_browser(user["id"], hash_user_agent(agent))
|
||||
from config.config_db import get_db_pool
|
||||
|
||||
pool = get_db_pool()
|
||||
async with pool.acquire() as connection, connection.cursor() as cursor:
|
||||
await cursor.execute(
|
||||
"""UPDATE users SET last_login = CURRENT_TIMESTAMP,
|
||||
auth_expires_at = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL 3 MONTH)
|
||||
WHERE id = %s""",
|
||||
(user["id"],),
|
||||
)
|
||||
await connection.commit()
|
||||
session_id = await create_session(user["id"], agent)
|
||||
await record_login(user["id"], user["email"], "SUCCESS", None, agent)
|
||||
response = JSONResponse(
|
||||
|
||||
Reference in New Issue
Block a user