Skip to content

Commit

Permalink
Merge pull request #95 from mayureshagashe2105/prod
Browse files Browse the repository at this point in the history
Login and signup method update
  • Loading branch information
HemanthSai7 committed Aug 25, 2023
2 parents 521dba5 + cf3fe79 commit 0f20ddf
Show file tree
Hide file tree
Showing 6 changed files with 356 additions and 54 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
__pycache__
.vercel
tempCodeRunnerFile.py
.pytest_cache
.pytest_cache
migrate.py
2 changes: 1 addition & 1 deletion API/fwapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def scoped_checks(user_creds: UserOut):

@app.post('/auth/login', summary="Log-in to the user account", response_model=TokenSchema,
tags=["Authorization Server"])
async def auth_login(form_data: UserAuth = Depends()):
async def auth_login(form_data: UserAuth):
tokens = {
"status": "Internal Server Error 500",
"access_token": "",
Expand Down
18 changes: 9 additions & 9 deletions API/services/auth/AuthServices.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ def signup(response_result: FrontendResponseModel, data: Union[UserAuth,BulkSign
response_result['message'] = [f'User with this AADHAR NO created successfully']

else:
AADHAR_NOS=data.AADHAR_NOS
passwords=[Auth.get_password_hash(passwd) for passwd in data.passwords]
village_name=data.village_name
AADHAR_NOS = data.AADHAR_NOS
passwords = data.passwords
village_name = data.village_name

users=DBQueries.filtered_db_search("Auth", role_manager.user, ["_id","password","village_name"], search_idxs={"AADHAR":{"$in":AADHAR_NOS}})
users=[user["AADHAR"] for user in users]
users = DBQueries.filtered_db_search("Auth", role_manager.user, ["_id","password","village_name"], search_idxs={"AADHAR":{"$in":AADHAR_NOS}})
users = [user["AADHAR"] for user in users]

invalid_users=[]
valid_users=[]
invalid_users = []
valid_users = []

for user in zip(AADHAR_NOS,passwords):
userinfo = {
Expand All @@ -64,8 +64,8 @@ def signup(response_result: FrontendResponseModel, data: Union[UserAuth,BulkSign
if user[0] in users:
invalid_users.append(user[0])
else:
userinfo["AADHAR"]=user[0]
userinfo["password"]=user[1]
userinfo["AADHAR"] = user[0]
userinfo["password"] = Auth.get_password_hash(user[1])
valid_users.append(userinfo)

if len(valid_users)!=0:
Expand Down
Loading

0 comments on commit 0f20ddf

Please sign in to comment.