__author__ = 'sagi' from google.appengine.ext import db from models.User import User from google.appengine.api import mail def get_user_by_token(token): query = User.all() query.filter("seToken = ", token) for u in query.run(limit = 1): return u return None def is_user_token_valid(token): user = get_user_by_token(token) if user is not None: return True return False def is_lecturer(token): user = get_user_by_token(token) if user is None: return False return user.isLecturer def send_validation_email(token, email, name): emailSuffix = str(email).split('@')[1] message = mail.EmailMessage(sender="SE-Hub Support ", subject="SE-Hub Activate Account") message.to = email message.body = """ Dear """+name+""": To Activate your SE-Hub Account please click on the link below:
http://se-hub.appspot.com/api/validation/confirm/"""+token+"""|"""+emailSuffix+""" to get access to your Campus :) Please let us know if you have any questions. SE-Hub (c) 2015 niptop Team. """ message.html = """

Hey """+name+"""- Just one More Step...

Dear """+name+""":

To Activate your SE-Hub Account please click on the link below:
http://se-hub.appspot.com/api/validation/confirm/"""+token+"""|"""+emailSuffix+""" to access you virtual class.


Please let us know if you have any questions.
SE-Hub (c) 2015 niptop Team. """ message.send()