# Path: model.py
# class User(db.Model):
#     __tablename__ = 'user'
#     id = db.Column(db.Integer, name='id', primary_key=True)
#     username = db.Column(db.String, name='username', unique=True, nullable=False)
#     password = db.Column(db.String, name='password', nullable=False)
#     active = db.Column(db.Boolean, name='active', nullable=False)
# 
#     preferences = db.relationship('UserPreference', collection_class=attribute_mapped_collection('key'), cascade="all, delete-orphan")
# 
#     def is_authenticated(self):
#         return True
# 
#     def is_active(self):
#         return self.active
# 
#     def is_anonymous(self):
#         return False
# 
#     def has_strava(self):
#         return 'strava' in self.preferences
# 
#     def get_strava_access_token(self):
#         assert self.has_strava()
#         return self.preferences['strava'].value['access_token']
# 
#     def get_id(self):
#         return self.username


from flask_login import LoginManager
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField
from model import User
#!/usr/bin/env python



login_manager = LoginManager()


class LoginForm(FlaskForm):
    username = StringField()
    password = PasswordField()


@login_manager.user_loader

# Path: model.py
# class User(db.Model):
#     __tablename__ = 'user'
#     id = db.Column(db.Integer, name='id', primary_key=True)
#     username = db.Column(db.String, name='username', unique=True, nullable=False)
#     password = db.Column(db.String, name='password', nullable=False)
#     active = db.Column(db.Boolean, name='active', nullable=False)
# 
#     preferences = db.relationship('UserPreference', collection_class=attribute_mapped_collection('key'), cascade="all, delete-orphan")
# 
#     def is_authenticated(self):
#         return True
# 
#     def is_active(self):
#         return self.active
# 
#     def is_anonymous(self):
#         return False
# 
#     def has_strava(self):
#         return 'strava' in self.preferences
# 
#     def get_strava_access_token(self):
#         assert self.has_strava()
#         return self.preferences['strava'].value['access_token']
# 
#     def get_id(self):
#         return self.username


# Path: login.py
from flask_login import LoginManager
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField
from model import User

#!/usr/bin/env python



login_manager = LoginManager()


class LoginForm(FlaskForm):
    username = StringField()
    password = PasswordField()


@login_manager.user_loader

def load_user(username):