def generate_password_reset_link(email): user = get_user(email) if user is None: return None reset_key = os.urandom(16).encode('hex') user.password_reset_key = reset_key user.password_reset_expire = datetime.now() + dttimedelta(minutes=60) save_user(user) return url_for('reset', reset_key = reset_key, _external=True)
def __get_end_datetime(start_datetime, duration): if start_datetime is None or duration is None: return None return start_datetime + dttimedelta(minutes=duration)