<commit_before>from flask import Flask, request, session, redirect, render_template, g, url_for, jsonify
from functools import wraps

from commandrunner import CommandRunner

import requests, sqlite3, os, bcrypt

application = Flask(__name__)
application.config['DEBUG'] = True
application.secret_key = 'as3r14saf3tGWEF'

salt = <PASSWORD>"

def login_required(f):
	@wraps(f)
	def decorated_function(*args, **kwargs):

		try:

			if session['logged_in'] != True:

				return redirect("/login", code=302)

			return f(*args, **kwargs)

		except KeyError, e:

			return redirect("/login", code=302)

	return decorated_function


@application.route('/logout', methods=['GET', 'POST'])
def logout():

	session['username'] = None
	session['logged_in'] = None

	return render_template('login.html')


@application.route('/login', methods=['GET', 'POST'])
def login():

	if request.method == 'POST':

		username = request.form['username']
		password = request.form['password']

		password = <PASSWORD>.hashpw(password.encode('utf8'), salt)

		session['username'] = request.form['username']

		try:

			conn = sqlite3.connect('confgrdb.db')
			c = conn.cursor()

			selectuser = """SELECT username, password FROM users WHERE username = '""" + username + """'"""
			c.execute(selectuser)

			result = c.fetchone()

		except Exception:

			return render_template('500.html', title=title, username=session['username']), 500
<commit_msg>update confgr.py usage of bcrypto to support Python3<commit_after>from flask import Flask, request, session, redirect, render_template, g, url_for, jsonify
from functools import wraps

from commandrunner import CommandRunner

import requests, sqlite3, os, bcrypt

application = Flask(__name__)
application.config['DEBUG'] = True
application.secret_key = 'as3r14saf3tGWEF'

salt = "$2b$12$t8q0bzSdcveQ4A.GE/7TLu"

def login_required(f):
	@wraps(f)
	def decorated_function(*args, **kwargs):

		try:

			if session['logged_in'] != True:

				return redirect("/login", code=302)

			return f(*args, **kwargs)

		except KeyError:

			return redirect("/login", code=302)

	return decorated_function


@application.route('/logout', methods=['GET', 'POST'])
def logout():

	session['username'] = None
	session['logged_in'] = None

	return render_template('login.html')


@application.route('/login', methods=['GET', 'POST'])
def login():

	if request.method == 'POST':

		username = request.form['username']
		password = request.form['password']


		password = bcrypt.hashpw(password.encode('utf8'), salt.encode('utf8')).decode('utf8')

		print (password)

		session['username'] = username

		try:

			conn = sqlite3.connect('confgrdb.db')
			c = conn.cursor()

			selectuser = """SELECT username, password FROM users WHERE username = '""" + username + """'"""
			c.execute(selectuser)

			result = c.fetchone()

		except Exception:

			return render_template('500.html', title=title, username=session['username']), 500

{'fraction_non_alphanumeric': 0.15219611848825332, 'fraction_numerical': 0.01634320735444331, 'mean_word_length': 5.108108108108108, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4354033', 'n_tokens_mistral': 1038, 'n_tokens_neox': 906, 'n_words': 224}