mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
19 lines
600 B
Python
19 lines
600 B
Python
|
from flask import current_app
|
||
|
from itsdangerous import URLSafeTimedSerializer
|
||
|
|
||
|
|
||
|
def generate_confirmation_token(email):
|
||
|
serializer = URLSafeTimedSerializer(current_app.config['SECRET_KEY'])
|
||
|
return serializer.dumps(email, salt=current_app.config['SALT'])
|
||
|
|
||
|
|
||
|
def confirm_token(token, expiration=86400):
|
||
|
serializer = URLSafeTimedSerializer(current_app.config['SECRET_KEY'])
|
||
|
try:
|
||
|
email = serializer.loads(token,
|
||
|
salt=current_app.config['SALT'],
|
||
|
max_age=expiration)
|
||
|
except:
|
||
|
return False
|
||
|
return email
|