<commit_before>import bcrypt

from flask import flash, get_flashed_messages, redirect, render_template, \
	request, url_for, abort
from flask import Blueprint, Markup
from flask.ext.login import current_user, login_user, logout_user

from viaduct import application, db, login_manager
from viaduct.helpers import flash_form_errors
from forms import SignUpForm, SignInForm
from models import User, UserPermission

blueprint = Blueprint('user', __name__)

@login_manager.user_loader
def load_user(id):
	# The hook used by the login manager to get the user from the database by
	# user ID.
	return User.query.get(int(id))

def load_anonymous_user():
	return User.query.filter(User.email=='anonymous').first()

@blueprint.route('/sign-up/', methods=['GET', 'POST'])
def sign_up():
	# Redirect the user to the index page if he or she has been authenticated
	# already.
	if current_user and current_user.is_authenticated():
		return redirect(url_for('page.get_page'))

	form = SignUpForm(request.form)

	if form.validate_on_submit():
		user = User(form.email.data, bcrypt.hashpw(form.password.data, bcrypt.gensalt()),
			form.first_name.data, form.last_name.data)
<commit_msg>sign up made possible<commit_after>import bcrypt

from flask import flash, get_flashed_messages, redirect, render_template, \
	request, url_for, abort
from flask import Blueprint, Markup
from flask.ext.login import current_user, login_user, logout_user

from viaduct import application, db, login_manager
from viaduct.helpers import flash_form_errors
from forms import SignUpForm, SignInForm
from models import User, UserPermission

blueprint = Blueprint('user', __name__)

@login_manager.user_loader
def load_user(id):
	# The hook used by the login manager to get the user from the database by
	# user ID.
	return User.query.get(int(id))

def load_anonymous_user():
	return User.query.filter(User.email=='anonymous').first()

@blueprint.route('/sign-up/', methods=['GET', 'POST'])
def sign_up():
	# Redirect the user to the index page if he or she has been authenticated
	# already.
	if current_user and current_user.is_authenticated():
		return redirect(url_for('page.get_page'))

	form = SignUpForm(request.form)

	if form.validate_on_submit():
		user = User(form.email.data, <PASSWORD>.hashpw(form.password.data, bcrypt.gensalt()),
			form.first_name.data, form.last_name.data, form.student_id)

{'fraction_non_alphanumeric': 0.10215280709159984, 'fraction_numerical': 0.0, 'mean_word_length': 5.771428571428571, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1763638', 'n_tokens_mistral': 767, 'n_tokens_neox': 744, 'n_words': 220}