Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login and signup method update #95

Merged
merged 2 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading