<commit_before>from flask import Blueprint, render_template
from flask import url_for, redirect, request, jsonify
from flask.ext.login import current_user, login_required

from ark.exts import db
from ark.account.forms import SignUpForm, SignInForm, ChangePassword
from ark.account.models import Account
from ark.account.services import (signin_user,  signout_user,
                                  signup_user, add_signin_score)


account_app = Blueprint('account', __name__)


@account_app.route('/account/signin', methods=['GET', 'POST'])
def signin():
    if not current_user.is_anonymous():
        return redirect(url_for('master.index'))

    form = SignInForm(request.form)

    if form.validate_on_submit():
        email = form.data['email'].strip()
        password = form.data['password'].strip() 
        is_remember_me = form.data.get('remember_me', 'f') == 'y'
        user = Account.query.authenticate(email, password)
        if user:
            add_signin_score(user)
            signin_user(user, remember=is_remember_me)
            return jsonify(success=True)
        else:
            return jsonify(success=False)

    if form.errors:
        return jsonify(success=False, messages=form.errors)

    return render_template('account/signin.html', form=form)


@account_app.route('/account/signup', methods=['GET', 'POST'])
def signup():
    if not current_user.is_anonymous():
        return redirect(url_for('master.index'))

    form = SignUpForm(request.form)

    if form.validate_on_submit():
        email = form.data['email'].strip()
        username = form.data['username'].strip()
        password = form.data['password'].strip()
        gender = form.data['gender']

        user = Account(
            email=email,
            username=username,
            password=password,
            gender=gender,
        )
        db.session.add(user)
        signup_user(user)
        db.session.commit()

        return jsonify(success=True)

    if form.errors:
        return jsonify(success=False)

    return render_template('account/signup.html', form=form)
<commit_msg>return message<commit_after>from flask import Blueprint, render_template
from flask import url_for, redirect, request, jsonify
from flask.ext.login import current_user, login_required

from ark.exts import db
from ark.account.forms import SignUpForm, SignInForm, ChangePassword
from ark.account.models import Account
from ark.account.services import (signin_user,  signout_user,
                                  signup_user, add_signin_score)


account_app = Blueprint('account', __name__)


@account_app.route('/account/signin', methods=['GET', 'POST'])
def signin():
    if not current_user.is_anonymous():
        return redirect(url_for('master.index'))

    form = SignInForm(request.form)

    if form.validate_on_submit():
        email = form.data['email'].strip()
        password = form.data['password'].strip() 
        is_remember_me = form.data.get('remember_me', 'f') == 'y'
        user = Account.query.authenticate(email, password)
        if user:
            add_signin_score(user)
            signin_user(user, remember=is_remember_me)
            return jsonify(success=True)
        else:
            return jsonify(success=False)

    if form.errors:
        return jsonify(success=False, messages=form.errors)

    return render_template('account/signin.html', form=form)


@account_app.route('/account/signup', methods=['GET', 'POST'])
def signup():
    if not current_user.is_anonymous():
        return redirect(url_for('master.index'))

    form = SignUpForm(request.form)

    if form.validate_on_submit():
        email = form.data['email'].strip()
        username = form.data['username'].strip()
        password = form.data['password'].strip()
        gender = form.data['gender']

        user = Account(
            email=email,
            username=username,
            password=password,
            gender=gender,
        )
        db.session.add(user)
        signup_user(user)
        db.session.commit()

        return jsonify(success=True)

    if form.errors:
        return jsonify(success=False, messages=form.errors)

    return render_template('account/signup.html', form=form)

{'fraction_non_alphanumeric': 0.11699361852989837, 'fraction_numerical': 0.0, 'mean_word_length': 2.933085501858736, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2716216', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1209, 'n_words': 250}