Skip to content

Commit 9eaeae6

Browse files
committed
Send stream information
1 parent 7dfdbbb commit 9eaeae6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Network/Lambda/lambda_function.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,25 @@ def account_insert(event, pathPara, queryPara):
447447
return json_payload({"id": a.account_id, "token": a.token})
448448

449449

450+
@api.handle("/account/email/device", httpMethod=MPC_API.POST)
451+
def account_signin(event, pathPara, queryPara):
452+
"""Handles users reset their account by verifying their username in the database"""
453+
body: dict = event["body"]
454+
455+
account = database.get_by_field(Account, Account.TOKEN, body[Account.TOKEN])
456+
hardware = database.get_by_field(Hardware, Hardware.DEVICE_ID, body[Hardware.DEVICE_ID])
457+
if account is None:
458+
return json_payload({"message": Error.TOKEN_MISMATCH}, True)
459+
if hardware is None:
460+
return json_payload({"message": Error.DEVICE_NOT_FOUND}, True)
461+
462+
if EmailSender.send(account.email,
463+
"[MPC Account] Stream Information", f"Ingest Endpoint: \n{hardware.ingest_endpoint}\nStream Key: {hardware.stream_key}"):
464+
return json_payload({"message": "Code sent"})
465+
else:
466+
return json_payload({"message": "Failed to send code"})
467+
468+
450469
@api.handle("/account/{id}")
451470
def account_request_by_id(event, pathPara, queryPara):
452471
"""Gets account based on specified id"""

0 commit comments

Comments
 (0)