<commit_before># This contains our frontend; since it is a bit messy to use the @app.route
# decorator style when using application factories, all of our routes are
# inside blueprints. This is the front-facing blueprint.
#
# You can find out more about blueprints at
# http://flask.pocoo.org/docs/blueprints/

# Flask modules
from flask import Blueprint, render_template, abort, redirect, url_for, session, request, flash, current_app, g
from flask_nav.elements import Navbar, View, Subgroup, Link, Text, Separator

# FLask Login
from flask_login import login_user, logout_user, current_user, login_required

# WTForms
from flask_wtf import Form, RecaptchaField
from wtforms import StringField, SubmitField, PasswordField
from wtforms.validators import DataRequired

# Let's start!

login_bp = Blueprint('login_bp', __name__)

from topitup import db
# Structure of User data located in phpBB
class User(db.Model):
    __tablename__ = "phpbb_users"
    id = db.Column('user_id', db.Integer, primary_key=True)
    username = db.Column('username_alias', db.String(63), unique=True , index=True)
    password = db.Column('<PASSWORD>' , db.String(255))
    email = db.Column('user_email', db.String(100), unique=True, index=True)

    def __init__(self, username, password, email):
        self.username = username
        self.password = password
        self.email = email

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        return unicode(self.id)

    def __repr__(self):
        return '<User %r>' % (self.username)

# Login Form
class LoginForm(Form):
    username = StringField('username', validators=[DataRequired()])
    password = PasswordField('password', validators=[DataRequired()])
    recaptcha = RecaptchaField('Spam protection')
    submit = SubmitField("Login")

@login_bp.route('/login', methods=('GET', 'POST'))
#def login():
def index():
    if request.method == 'GET':
        form = LoginForm()
#       if form.validate_on_submit():
        return render_template('login.html', form=form)

    username = request.form['username']
    password = request.form['password']
    registered_user = User.query.filter_by(username=username,password=password).first()

    if registered_user is None:
        flash('Username or Password is invalid', 'error')
        return redirect(url_for('login'))
    login_user(registered_user)
    flash('Logged in successfully')

    return redirect(request.args.get('next') or url_for('index'))
<commit_msg>SQL is running properly, but password is encrypted, we must deploy verfication<commit_after># This contains our frontend; since it is a bit messy to use the @app.route
# decorator style when using application factories, all of our routes are
# inside blueprints. This is the front-facing blueprint.
#
# You can find out more about blueprints at
# http://flask.pocoo.org/docs/blueprints/

# Flask modules
from flask import Blueprint, render_template, abort, redirect, url_for, session, request, flash, current_app, g
from flask_nav.elements import Navbar, View, Subgroup, Link, Text, Separator

# FLask Login
from flask_login import login_user, logout_user, current_user, login_required

# WTForms
from flask_wtf import Form, RecaptchaField
from wtforms import StringField, SubmitField, PasswordField
from wtforms.validators import DataRequired

# Let's start!

login_bp = Blueprint('login_bp', __name__)

from topitup import db
# Structure of User data located in phpBB
class User(db.Model):
    __tablename__ = "phpbb_users"
    id = db.Column('user_id', db.Integer, primary_key=True)
    username = db.Column('username_alias', db.String(63), unique=True , index=True)
    password = db.Column('<PASSWORD>_password' , db.String(255))
    email = db.Column('user_email', db.String(100), unique=True, index=True)

    def __init__(self, username, password, email):
        self.username = username
        self.password = password
        self.email = email

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        return unicode(self.id)

    def __repr__(self):
        return '<User %r>' % (self.username)

# Login Form
class LoginForm(Form):
    username = StringField('username', validators=[DataRequired()])
    password = PasswordField('password', validators=[DataRequired()])
    recaptcha = RecaptchaField('Spam protection')
    submit = SubmitField("Login")

@login_bp.route('/login', methods=('GET', 'POST'))
#def login():
def index():
    if request.method == 'GET':
        form = LoginForm()
#       if form.validate_on_submit():
        return render_template('login.html', form=form)

    username = request.form['username']
    password = request.form['password']
    registered_user = User.query.filter_by(username=username,password=password).first()

    if registered_user is None:
        flash('Username or Password is invalid', 'error')
        return redirect('/login')

    login_user(registered_user)
    flash('Logged in successfully')

    return redirect('/')

{'fraction_non_alphanumeric': 0.11046959199384142, 'fraction_numerical': 0.003079291762894534, 'mean_word_length': 4.120197044334976, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5745621', 'n_tokens_mistral': 1563, 'n_tokens_neox': 1496, 'n_words': 447}