FEAT: Email now also shows the username of the account whos password will be reset
This commit is contained in:
@@ -73,7 +73,7 @@ def stripe_webhook():
|
|||||||
product_id = stripe.checkout.Session.list_line_items(session['id'])['data'][0]['price']['product']
|
product_id = stripe.checkout.Session.list_line_items(session['id'])['data'][0]['price']['product']
|
||||||
if product_id == subscription:
|
if product_id == subscription:
|
||||||
client_reference_id = session.get("client_reference_id")
|
client_reference_id = session.get("client_reference_id")
|
||||||
user_id, streamer_id = client_reference_id.split("-")
|
user_id, streamer_id = map(int, client_reference_id.split("-"))
|
||||||
print(f"user_id: {user_id} is subscribing to streamer_id: {streamer_id}", flush=True)
|
print(f"user_id: {user_id} is subscribing to streamer_id: {streamer_id}", flush=True)
|
||||||
subscribe(user_id, streamer_id)
|
subscribe(user_id, streamer_id)
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from os import getenv
|
|||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from utils.auth import generate_token
|
from utils.auth import generate_token
|
||||||
from secrets import token_hex
|
from secrets import token_hex
|
||||||
|
from .user_utils import get_session_info_email
|
||||||
import redis
|
import redis
|
||||||
|
|
||||||
redis_url = "redis://redis:6379/1"
|
redis_url = "redis://redis:6379/1"
|
||||||
@@ -57,6 +58,7 @@ def forgot_password_body(email) -> str:
|
|||||||
token = generate_token(email, salt)
|
token = generate_token(email, salt)
|
||||||
token += "R3sET"
|
token += "R3sET"
|
||||||
r.setex(token, 3600, salt)
|
r.setex(token, 3600, salt)
|
||||||
|
username = (get_session_info_email(email))["username"]
|
||||||
|
|
||||||
full_url = url + "/reset_password/" + token
|
full_url = url + "/reset_password/" + token
|
||||||
content = f"""
|
content = f"""
|
||||||
@@ -66,8 +68,8 @@ def forgot_password_body(email) -> str:
|
|||||||
<title>Password Reset</title>
|
<title>Password Reset</title>
|
||||||
<style>
|
<style>
|
||||||
body {{ font-family: Arial, sans-serif; background-color: #f4f4f4; padding: 20px; text-align: center; }}
|
body {{ font-family: Arial, sans-serif; background-color: #f4f4f4; padding: 20px; text-align: center; }}
|
||||||
.container {{ max-width: 500px; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); }}
|
.container {{ background: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); }}
|
||||||
.btn {{ display: inline-block; padding: 10px 20px; color: white; background-color: #FFFFFF; text-decoration: none; border-radius: 5px; border: 1px solid #000000; font-weight: bold;}}
|
.btn {{ display: inline-block; padding: 10px 20px; color: white; background-color: #FFFFFF; text-decoration: none; border-radius: 5px; border: 1px solid #000000; font-weight: bold; }}
|
||||||
.btn:hover {{ background-color: #E0E0E0; }}
|
.btn:hover {{ background-color: #E0E0E0; }}
|
||||||
p {{ color: #000000; }}
|
p {{ color: #000000; }}
|
||||||
a.btn {{ color: #000000; }}
|
a.btn {{ color: #000000; }}
|
||||||
@@ -77,13 +79,14 @@ def forgot_password_body(email) -> str:
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Gander</h1>
|
<h1>Gander</h1>
|
||||||
<h2>Password Reset Request</h2>
|
<h2>Password Reset Request</h2>
|
||||||
<p>Click the button below to reset your password. This link is valid for 1 hour.</p>
|
<p>Click the button below to reset your password for your account {username}. This link is valid for 1 hour.</p>
|
||||||
<a href="{full_url}" class="btn">Reset Password</a>
|
<a href="{full_url}" class="btn">Reset Password</a>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def confirm_account_creation_body(email) -> str:
|
def confirm_account_creation_body(email) -> str:
|
||||||
@@ -105,7 +108,7 @@ def confirm_account_creation_body(email) -> str:
|
|||||||
<title>Password Reset</title>
|
<title>Password Reset</title>
|
||||||
<style>
|
<style>
|
||||||
body {{ font-family: Arial, sans-serif; background-color: #f4f4f4; padding: 20px; text-align: center; }}
|
body {{ font-family: Arial, sans-serif; background-color: #f4f4f4; padding: 20px; text-align: center; }}
|
||||||
.container {{ max-width: 500px; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); }}
|
.container {{ background: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); }}
|
||||||
.btn {{ display: inline-block; padding: 10px 20px; color: white; background-color: #FFFFFF; text-decoration: none; border-radius: 5px; border: 1px solid #000000; font-weight: bold; }}
|
.btn {{ display: inline-block; padding: 10px 20px; color: white; background-color: #FFFFFF; text-decoration: none; border-radius: 5px; border: 1px solid #000000; font-weight: bold; }}
|
||||||
.btn:hover {{ background-color: #E0E0E0; }}
|
.btn:hover {{ background-color: #E0E0E0; }}
|
||||||
p {{ color: #000000; }}
|
p {{ color: #000000; }}
|
||||||
|
|||||||
Reference in New Issue
Block a user