예제 #1
0
 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
    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'))