コード例 #1
0
ファイル: main.py プロジェクト: rgm3/personal-backend
 def settings():
     if request.method == 'POST':
         password = request.form['password']
         if password != "":
             password = utils.hash_password(password)
         email = request.form['email']
         utils.change_user(password=password, mail=email)
         return json.dumps({'status': 'Saved'})
     user = utils.get_user()
     return render_template('settings.html', user=user)
コード例 #2
0
ファイル: main.py プロジェクト: rgm3/personal-backend
    def confirm(token):
        try:
            email = utils.confirm_token(token)
        except:
            flash('The confirmation link is invalid or has expired.')
            return redirect(url_for('login'))

        user = utils.get_user()
        if user and user.mail == email:
            if user.confirmed:
                flash('Account already confirmed. Please login.')
            else:
                utils.change_user(confirmed=True, confirmed_on=time.time())
                flash('You have confirmed your account. Thanks!')
        return redirect(url_for('login'))