File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 3
3
from fastapi .security import HTTPBasicCredentials
4
4
from passlib .context import CryptContext
5
5
6
- from app . server .database .database import admin_collection
6
+ from server .database .database import admin_collection
7
7
#from app.server.auth.admin import validate_login
8
- from app . server .auth .jwt_handler import signJWT
9
- from app . server .database .database import add_admin
10
- from app . server .models .admin import AdminModel
8
+ from server .auth .jwt_handler import signJWT
9
+ from server .database .database import add_admin
10
+ from server .models .admin import AdminModel
11
11
12
12
router = APIRouter ()
13
13
@@ -37,9 +37,10 @@ async def admin_login(admin_credentials: HTTPBasicCredentials = Body(...)):
37
37
38
38
@router .post ("/" )
39
39
async def admin_signup (admin : AdminModel = Body (...)):
40
- admin = await admin_collection .find_one ({"email" : admin .email }, {"_id" : 0 })
41
- if (admin ):
40
+ admin_exists = await admin_collection .find_one ({"email" : admin .email }, {"_id" : 0 })
41
+ if (admin_exists ):
42
42
return "Email already exists"
43
+
43
44
admin .password = hash_helper .encrypt (admin .password )
44
45
new_admin = await add_admin (jsonable_encoder (admin ))
45
46
return new_admin
You can’t perform that action at this time.
0 commit comments