示例#1
0
def view_game(game_id):
    ''' display info on a particular game '''
    this_game = Game.query.get(game_id)
    if this_game.public or current_user in this_game.players:
        return render_template('game.html',
                               game=this_game,
                               details=this_game.get_score_table())
    return error_response(404)
示例#2
0
def confirm_email(token):
    try:
        email = serializer.loads(token,
                                 salt="email-confirm-key",
                                 max_age=86400)
    except:
        return error_response(404)

    user = User.query.filter_by(email=email).first_or_404()
    user.email_confirmed = True
    db.session.commit()
    return redirect(url_for('signin'))
示例#3
0
def reset_with_token(token):
    try:
        email = serializer.loads(token, salt="recover-key", max_age=86400)
    except:
        return error_response(404)

    form = PasswordForm()

    if not form.validate_on_submit():
        return render_template('reset_with_token.html', form=form, token=token)

    user = User.query.filter_by(email=email).first_or_404()
    user.set_password(form.password.data)
    db.session.commit()
    return redirect(url_for('login'))
示例#4
0
文件: api.py 项目: Codyfjm/zapsScorer
def api_token_auth_error():
    return error_response(401)