|
2 | 2 | from datetime import date |
3 | 3 |
|
4 | 4 | from fastapi import APIRouter, Request, Response |
5 | | -from passlib.hash import bcrypt |
| 5 | +from passlib.hash import bcrypt, bcrypt_sha256 |
6 | 6 | from tortoise.transactions import atomic, in_transaction |
7 | 7 |
|
8 | 8 | import pwncore.containerASD as containerASD |
|
29 | 29 | if config.development: |
30 | 30 | logging.basicConfig(level=logging.INFO) |
31 | 31 |
|
32 | | -ADMIN_HASH = "$2b$12$USIGDWgl8WSgSoGauDTKE.ZAKyInaJn84fsZ.ARA6FmntIZeNCTUq" |
33 | 32 | NAMES = [ |
34 | 33 | "Mimas", |
35 | 34 | "Enceladus", |
@@ -57,7 +56,7 @@ async def _del_cont(id: str): |
57 | 56 | async def calculate_team_coins( |
58 | 57 | response: Response, req: Request |
59 | 58 | ): # Inefficient, anyways will be used only once |
60 | | - if not bcrypt.verify((await req.body()).strip(), ADMIN_HASH): |
| 59 | + if not bcrypt_sha256.verify((await req.body()).strip(), config.admin_hash): # Use config.admin_hash |
61 | 60 | response.status_code = 401 |
62 | 61 | return |
63 | 62 | async with in_transaction(): |
@@ -88,7 +87,7 @@ async def calculate_team_coins( |
88 | 87 | async def init_db( |
89 | 88 | response: Response, req: Request |
90 | 89 | ): # Inefficient, anyways will be used only once |
91 | | - if not bcrypt.verify((await req.body()).strip(), ADMIN_HASH): |
| 90 | + if not bcrypt_sha256.verify((await req.body()).strip(), config.admin_hash): |
92 | 91 | response.status_code = 401 |
93 | 92 | return |
94 | 93 | await Problem.create( |
|
0 commit comments