from itsdangerous import URLSafeTimedSerializer
from app import app
def generate_confirmation_token(email):
    serializer=URLSafeTimedSerializer(app.config['SECRET_KEY'])
    return serializer.dumps(email,salt=app.config['SECURITY_PASSWORD_SALT'])

def confirm_token(token,expiration=86400):
    serializer=URLSafeTimedSerializer(app.config['SECRET_KEY'])
    try:
        email=serializer.loads(token,salt=app.config['SECURITY_PASSWORD_SALT'],max_age=expiration)
    except:
        return False
    return email






from itsdangerous import URLSafeTimedSerializer
from app import app
def generate_confirmation_token(email):
    serializer=URLSafeTimedSerializer(app.config['SECRET_KEY'])
    return serializer.dumps(email,salt=app.config['SECURITY_PASSWORD_SALT'])

def confirm_token(token,expiration=86400):
    serializer=URLSafeTimedSerializer(app.config['SECRET_KEY'])
    try:
        email=serializer.loads(token,salt=app.config['SECURITY_PASSWORD_SALT'],max_age=expiration)
    except:
        return False
    return email





