<commit_before>from flask import request, flash, url_for, render_template, redirect
from flask.ext.login import login_user, logout_user, current_user, login_required
from sqlalchemy.exc import IntegrityError
from helpers import check_password
from formspree.app import DB
from models import User

def register():
    if request.method == 'GET':
        return render_template('users/register.html')
    try:
        user = User(request.form['email'], request.form['password'])
        DB.session.add(user)
        DB.session.commit()

    except IntegrityError:
        DB.session.rollback()
        flash("An account with this email already exists.", "error")
        return render_template('users/register.html')

    login_user(user)
    flash('Your account is successfully registered.')

    return redirect(url_for('dashboard'))

def login():
    if request.method == 'GET':
        if current_user.is_authenticated():
            return redirect(url_for('dashboard'))
        return render_template('users/login.html')
    email = request.form['email']
    password = request.form['password']
    remember_me = False
    if 'remember_me' in request.form:
        remember_me = True
    user = User.query.filter_by(email=email).first()
    if user is None:
        flash("We can't find an account related with this Email id. Please verify the Email entered.", "error")
        return redirect(url_for('login'))
    elif not check_password(user.password, password):
        flash("Invalid Password. Please verify the password entered.")
        return redirect(url_for('login'))
    login_user(user, remember = remember_me)
    flash('Logged in successfully')
    return redirect(request.args.get('next') or url_for('dashboard'))


def logout():
    logout_user()
    return redirect(url_for('index'))

@login_required
def dashboard():
    return render_template('forms/list.html')
<commit_msg>remove flash messages for success register and success login<commit_after>from flask import request, flash, url_for, render_template, redirect
from flask.ext.login import login_user, logout_user, current_user, login_required
from sqlalchemy.exc import IntegrityError
from helpers import check_password
from formspree.app import DB
from models import User

def register():
    if request.method == 'GET':
        return render_template('users/register.html')
    try:
        user = User(request.form['email'], request.form['password'])
        DB.session.add(user)
        DB.session.commit()

    except IntegrityError:
        DB.session.rollback()
        flash("An account with this email already exists.", "error")
        return render_template('users/register.html')

    login_user(user)
    # flash('Your account is successfully registered.') # this is ugly.

    return redirect(url_for('dashboard'))

def login():
    if request.method == 'GET':
        if current_user.is_authenticated():
            return redirect(url_for('dashboard'))
        return render_template('users/login.html')
    email = request.form['email']
    password = request.form['password']
    remember_me = False
    if 'remember_me' in request.form:
        remember_me = True
    user = User.query.filter_by(email=email).first()
    if user is None:
        flash("We can't find an account related with this Email id. Please verify the Email entered.", "error")
        return redirect(url_for('login'))
    elif not check_password(user.password, password):
        flash("Invalid Password. Please verify the password entered.")
        return redirect(url_for('login'))
    login_user(user, remember = remember_me)
    # flash('Logged in successfully') # this is ugly
    return redirect(request.args.get('next') or url_for('dashboard'))


def logout():
    logout_user()
    return redirect(url_for('index'))

@login_required
def dashboard():
    return render_template('forms/list.html')

{'fraction_non_alphanumeric': 0.11010830324909747, 'fraction_numerical': 0.0, 'mean_word_length': 3.6847826086956523, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4789317', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1047, 'n_words': 304}