Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
user_roles = db.Table(
db.Column('user_id', db.Integer, db.ForeignKey('')),
db.Column('role_id', db.Integer, db.ForeignKey(''))
# Define User and Role models
class Role(db.Model, RoleMixin):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
description = db.Column(db.String(255))
fs_uniquifier = db.Column(db.String(255), unique=True)
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(255), unique=True)
password = db.Column(db.String(255))
active = db.Column(db.Boolean())
fs_uniquifier = db.Column(db.String(255), unique=True)
roles = db.relationship('Role', secondary='user_roles', backref=db.backref('users', lazy='dynamic'))
@app.route('/login_user', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
email = request.form['email']
password = request.form['password']
user = user_datastore.find_user(email=email)
if user and bcrypt.checkpw(password.encode('utf-8'), user.password):
session["user"] =
return render_template('home.html')
return render_template('login.html')