From c470ebf42ddab65b3604d38a9a637ba9368bac34 Mon Sep 17 00:00:00 2001 From: Benjamin Ramhorst Date: Mon, 7 Feb 2022 13:15:57 +0000 Subject: [PATCH] Added placeholder functions to check if user is logged in --- api/authentication.py | 1 - lib/mail.py | 8 -------- lib/utils.py | 9 ++++++++- 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 lib/mail.py diff --git a/api/authentication.py b/api/authentication.py index 8c56b95..1da55cb 100644 --- a/api/authentication.py +++ b/api/authentication.py @@ -1,6 +1,5 @@ import json import lib.utils -from random import randint from flask import Response, Blueprint, request from firebase_admin import firestore, auth from firebase_admin._auth_utils import EmailAlreadyExistsError diff --git a/lib/mail.py b/lib/mail.py deleted file mode 100644 index b6781c7..0000000 --- a/lib/mail.py +++ /dev/null @@ -1,8 +0,0 @@ -from flask import current_app -from flask_mail import Mail, Message - -def send(subject, sender, recipients, body): - mail = Mail(current_app) - msg = Message(subject, sender=sender, recipients=recipients) - msg.body = body - mail.send(msg) \ No newline at end of file diff --git a/lib/utils.py b/lib/utils.py index 2488e41..ba7fbbf 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -1,7 +1,7 @@ from random import randint from flask import current_app from flask_mail import Mail, Message -from firebase_admin import firestore +from firebase_admin import auth, firestore def sendMail(subject, sender, recipients, body): mail = Mail(current_app) @@ -24,3 +24,10 @@ def sendVerificationMail(name, email, code): body = '''Hey {}! Thank you for signing up for BarkFinder. In order to use our sevices, could you please verify your email address by logging in and entering this code {}'''.format(name, code) sendMail(subject, sender, recipients, body) + +def userLoggedInAndVerfied(token): + # Need frontend to test this + # decoded_token = auth.verify_id_token(token) + # uid = decoded_token['uid'] + # isVerified = auth.get_user(uid).email_verified + return True #placeholder \ No newline at end of file