Added placeholder functions to check if user is logged in

This commit is contained in:
Benjamin Ramhorst 2022-02-07 13:15:57 +00:00
parent 8b1ce01079
commit c470ebf42d
3 changed files with 8 additions and 10 deletions

View file

@ -1,6 +1,5 @@
import json import json
import lib.utils import lib.utils
from random import randint
from flask import Response, Blueprint, request from flask import Response, Blueprint, request
from firebase_admin import firestore, auth from firebase_admin import firestore, auth
from firebase_admin._auth_utils import EmailAlreadyExistsError from firebase_admin._auth_utils import EmailAlreadyExistsError

View file

@ -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)

View file

@ -1,7 +1,7 @@
from random import randint from random import randint
from flask import current_app from flask import current_app
from flask_mail import Mail, Message from flask_mail import Mail, Message
from firebase_admin import firestore from firebase_admin import auth, firestore
def sendMail(subject, sender, recipients, body): def sendMail(subject, sender, recipients, body):
mail = Mail(current_app) mail = Mail(current_app)
@ -24,3 +24,10 @@ def sendVerificationMail(name, email, code):
body = '''Hey {}! Thank you for signing up for BarkFinder. 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) 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) 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