mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: email resetting frontend code
This commit is contained in:
parent
15677a6946
commit
1987e56b9a
9 changed files with 451 additions and 5 deletions
|
|
@ -25,11 +25,12 @@ def send_account_creation_email(
|
|||
|
||||
|
||||
def send_password_reset_email(
|
||||
reset_email_invite_uuid: str,
|
||||
generated_reset_code: str,
|
||||
user: UserRead,
|
||||
organization: OrganizationRead,
|
||||
email: EmailStr,
|
||||
):
|
||||
|
||||
# send email
|
||||
return send_email(
|
||||
to=email,
|
||||
|
|
@ -38,7 +39,7 @@ def send_password_reset_email(
|
|||
<html>
|
||||
<body>
|
||||
<p>Hello {user.username}</p>
|
||||
<p>Click <a href="https://{organization.slug}.learnhouse.io/reset-password?resetEmailInviteUuid={reset_email_invite_uuid}">here</a> to reset your password.</p>
|
||||
<p>Click <a href="https://{organization.slug}.learnhouse.io/reset?email={email}&resetCode={generated_reset_code}">here</a> to reset your password.</p>
|
||||
</body>
|
||||
</html>
|
||||
""",
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ async def send_reset_password_code(
|
|||
|
||||
# Send reset code via email
|
||||
isEmailSent = send_password_reset_email(
|
||||
reset_email_invite_uuid=reset_email_invite_uuid,
|
||||
generated_reset_code=generated_reset_code,
|
||||
user=user,
|
||||
organization=org,
|
||||
email=user.email,
|
||||
|
|
@ -132,7 +132,7 @@ async def change_password_with_reset_code(
|
|||
status_code=400,
|
||||
detail="User does not exist",
|
||||
)
|
||||
|
||||
|
||||
# Get org
|
||||
statement = select(Organization).where(Organization.id == org_id)
|
||||
org = db_session.exec(statement).first()
|
||||
|
|
@ -142,7 +142,6 @@ async def change_password_with_reset_code(
|
|||
status_code=400,
|
||||
detail="Organization not found",
|
||||
)
|
||||
|
||||
|
||||
# Redis init
|
||||
LH_CONFIG = get_learnhouse_config()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue