Beispiel #1
0
def korean():
    """ Switch user language to Korean """
    try:
        current_user.data['lang'] = 'kor'
        current_user.update_db()
    except:
        app.logger.info('ERROR: Exception while switching to Korean')
    return redirect(url_for('index'))
Beispiel #2
0
def english():
    """ Switch user language to English """
    try:
        current_user.data['lang'] = 'eng'
        current_user.update_db()
    except:
        app.logger.info('ERROR: Exception while switching to English')
    return redirect(url_for('index'))
Beispiel #3
0
def japanese():
    """ Switch user language to Japanese """
    try:
        current_user.data['lang'] = 'japanese'
        current_user.update_db()
    except:
        app.logger.info('ERROR: Exception while switching to Japanese')
    return redirect(url_for('index'))
Beispiel #4
0
def account():
    UpdateAccountForm.translate()
    form = UpdateAccountForm()
    if form.validate_on_submit():
        current_user.data['fname'] = form.fname.data.strip().strip()
        current_user.data['lname'] = form.lname.data.strip().strip()
        current_user.update_db()
        flash(tr('account_updated'), 'success')
        return redirect(url_for('account'))
    elif request.method == 'GET':
        form.username.data = current_user.data['username']
        form.email.data = current_user.data['email']
        form.fname.data = current_user.data['fname']
        form.lname.data = current_user.data['lname']
    return render_template('account.tmpl', title='Account', form=form)
Beispiel #5
0
def create_game():
    """ Create a new game in the database """
    try:
        data = request.json
        data.update({'username': current_user.data['username']})
        game = dbmodel.Game()

        # Store user IP with the game
        if request.headers.getlist("X-Forwarded-For"):
            ip = request.headers.getlist("X-Forwarded-For")[0]
        else:
            ip = request.remote_addr
        data.update({'ip_addr': ip})

        game.update_db(data)
        current_user.data['game_hash'] = game.id
        current_user.update_db()
        return jsonify({'game_hash': game.id})
    except:
        app.logger.info('ERROR: Exception in create_game()')
        return redirect(url_for('index'))
Beispiel #6
0
def korean():
    current_user.data['lang'] = 'kor'
    current_user.update_db()
    return redirect(url_for('index'))
Beispiel #7
0
def english():
    current_user.data['lang'] = 'eng'
    current_user.update_db()
    return redirect(url_for('index'))