def register(first_name, last_name, alias, email, password): hash = hash_password(password) user = User(email=email, role='user', password=hash, country='FI', region='18', preferred_language='fi', full_name=first_name + " " + last_name, short_name=first_name, given_names=first_name, family_name=last_name, alias=alias) save_user(user)
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)