Spaces:
Runtime error
Runtime error
Commit
Β·
1c097b9
1
Parent(s):
a7bb070
Update TechdocsAPI/backend/services/auth/ops.py
Browse files
TechdocsAPI/backend/services/auth/ops.py
CHANGED
@@ -50,21 +50,21 @@ async def ops_signup(bgtasks: BackgroundTasks, response_result: GeneralResponse,
|
|
50 |
|
51 |
# template = app.state.jinjaenv.get_template("email_verification.html")
|
52 |
# output = template.render(data=email_body_params)
|
53 |
-
email = "Hi {username} π\n\nWelcome to Techdocs! Please click on the link below to verify your account.\n\n<a href='{verify_link}'>Click Here</a>\n\nThanks,\nTechdocs Team".format(**email_body_params)
|
54 |
# bgtasks.add_task(app.state.mail_client.send_message, message=message, template_name="email_verification.html")
|
55 |
-
bgtasks.add_task(app.state.yagmail.send, to=data.email, subject="Welcome to Techdocs:[Account Verification]",
|
56 |
-
|
57 |
|
58 |
# bgtasks.add_task(app.state.mail_client.send_message, message=message, template_name="email_verification.html")
|
59 |
# await app.state.mail_client.send_message(message=message, template_name="email_verification.html")
|
60 |
|
61 |
-
DBQueries.insert_to_database('auth', (data.username, Auth.get_password_hash(data.password),
|
62 |
['username', 'password', 'email', 'is_verified'])
|
63 |
|
64 |
|
65 |
|
66 |
response_result.status = 'success'
|
67 |
-
response_result.message = [f'Activate your account by clicking on the link sent to {data.email}.\nMake sure to check your spam folder.']
|
68 |
|
69 |
def ops_login(data:LoginCreds):
|
70 |
"""Wrapper method to handle login process.
|
@@ -93,8 +93,8 @@ def ops_login(data:LoginCreds):
|
|
93 |
# password is incorrect
|
94 |
raise InvalidCredentialsException(response_result)
|
95 |
|
96 |
-
if not user[2]:
|
97 |
-
|
98 |
|
99 |
# password is correct
|
100 |
return TokenSchema(access_token=Auth.create_access_token(data.username),
|
|
|
50 |
|
51 |
# template = app.state.jinjaenv.get_template("email_verification.html")
|
52 |
# output = template.render(data=email_body_params)
|
53 |
+
# email = "Hi {username} π\n\nWelcome to Techdocs! Please click on the link below to verify your account.\n\n<a href='{verify_link}'>Click Here</a>\n\nThanks,\nTechdocs Team".format(**email_body_params)
|
54 |
# bgtasks.add_task(app.state.mail_client.send_message, message=message, template_name="email_verification.html")
|
55 |
+
# bgtasks.add_task(app.state.yagmail.send, to=data.email, subject="Welcome to Techdocs:[Account Verification]",
|
56 |
+
# contents=email)
|
57 |
|
58 |
# bgtasks.add_task(app.state.mail_client.send_message, message=message, template_name="email_verification.html")
|
59 |
# await app.state.mail_client.send_message(message=message, template_name="email_verification.html")
|
60 |
|
61 |
+
DBQueries.insert_to_database('auth', (data.username, Auth.get_password_hash(data.password), data.email, 1),
|
62 |
['username', 'password', 'email', 'is_verified'])
|
63 |
|
64 |
|
65 |
|
66 |
response_result.status = 'success'
|
67 |
+
# response_result.message = [f'Activate your account by clicking on the link sent to {data.email}.\nMake sure to check your spam folder.']
|
68 |
|
69 |
def ops_login(data:LoginCreds):
|
70 |
"""Wrapper method to handle login process.
|
|
|
93 |
# password is incorrect
|
94 |
raise InvalidCredentialsException(response_result)
|
95 |
|
96 |
+
# if not user[2]:
|
97 |
+
# raise EmailNotVerifiedException()
|
98 |
|
99 |
# password is correct
|
100 |
return TokenSchema(access_token=Auth.create_access_token(data.username),
|