fix: 코드 재검토 반영 — 댓글 더 보기, 긴 비밀번호 500 방지, 토큰 갱신 실패 처리, 연타 막기
This commit is contained in:
1 parent
ae6b06ac1f
commit
be8f827556
7 files changed
+88
-30
No files matched your search
@@ -21,7 +21,12 @@ async def hash_password(password: str) -> str:
|
||||
return (await asyncio.to_thread(bcrypt.hashpw, password.encode(), bcrypt.gensalt())).decode()
|
||||
|
||||
|
||||
PASSWORD_MAX_BYTES = 72 # bcrypt 가 받는 최대 길이
|
||||
|
||||
|
||||
async def verify_password(password: str, hashed: str) -> bool:
|
||||
if len(password.encode()) > PASSWORD_MAX_BYTES:
|
||||
return False
|
||||
return await asyncio.to_thread(bcrypt.checkpw, password.encode(), hashed.encode())
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user