Compare commits

...

2 Commits

Author SHA1 Message Date
5c6f049fb4 feat: Add e.hns.au email domain
All checks were successful
Build Docker / BuildImage (push) Successful in 52s
2024-10-09 15:59:50 +11:00
4e7bc0335c fix: Refresh emails when user logs in 2024-10-09 15:25:48 +11:00
3 changed files with 7 additions and 6 deletions

View File

@@ -95,7 +95,7 @@ def login():
# Get username and token from args # Get username and token from args
token = request.args.get("token") token = request.args.get("token")
# Set token cookie # Set token cookie
response = make_response(redirect("/inbox")) response = make_response(redirect("/refresh"))
response.set_cookie("token", token) response.set_cookie("token", token)
return response return response
@@ -370,7 +370,8 @@ def get_user(token):
@cache @cache
def get_email(email): def get_email(email:str):
altemail:str = f"{email.split('@')[0]}@e.hns.au"
params = { params = {
"embed": "threads", "embed": "threads",
"mailboxId": os.getenv("FREESCOUT_MAILBOX"), "mailboxId": os.getenv("FREESCOUT_MAILBOX"),
@@ -396,10 +397,10 @@ def get_email(email):
for conversation in conversations["_embedded"]["conversations"]: for conversation in conversations["_embedded"]["conversations"]:
addresses = conversation["cc"] addresses = conversation["cc"]
for address in addresses: for address in addresses:
if address == email: if address == email or address == altemail:
threads.append(parse_email(conversation)) threads.append(parse_email(conversation))
return {"email": email, "conversations": threads} return {"email": email, "emailalt": altemail,"conversations": threads}
@cache @cache

View File

@@ -12,7 +12,7 @@
<body> <body>
<header style="display: inline;"> <header style="display: inline;">
<img src="/favicon.png" style="width:50px;height:50px;"> <img src="/favicon.png" style="width:50px;height:50px;">
<h1>HNS Email</h1> <span style="float:right">{{emails.email}} | <a href="/notifications">Notifications</a> | <a <h1>HNS Email</h1>&nbsp; <span style="float:right">{{emails.email}} {{emails.emailalt}} | <a href="/notifications">Notifications</a> | <a
href="/logout">Logout</a></span> href="/logout">Logout</a></span>
</header> </header>
<br> <br>

View File

@@ -12,7 +12,7 @@
<body> <body>
<header style="display: inline;"> <header style="display: inline;">
<img src="/favicon.png" style="width:50px;height:50px;"> <img src="/favicon.png" style="width:50px;height:50px;">
<h1>HNS Email</h1> <span style="float:right">{{email}} | <a href="/inbox">Inbox</a> | <a <h1>HNS Email</h1>&nbsp; <span style="float:right">{{email}} | <a href="/inbox">Inbox</a> | <a
href="/logout">Logout</a></span> href="/logout">Logout</a></span>
</header> </header>