updated and removed unecesary files
This commit is contained in:
32
models.py
32
models.py
@@ -1,5 +1,6 @@
|
||||
from app import db
|
||||
from extensions import db
|
||||
from flask_bcrypt import Bcrypt
|
||||
from flask_login import UserMixin
|
||||
|
||||
bcrypt = Bcrypt()
|
||||
|
||||
@@ -8,7 +9,6 @@ class Content(db.Model):
|
||||
file_name = db.Column(db.String(120), nullable=False)
|
||||
duration = db.Column(db.Integer, nullable=False)
|
||||
player_id = db.Column(db.Integer, db.ForeignKey('player.id'), nullable=True)
|
||||
group_id = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=True)
|
||||
|
||||
class Player(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
@@ -20,4 +20,32 @@ class Player(db.Model):
|
||||
def verify_quickconnect_code(self, code):
|
||||
return bcrypt.check_password_hash(self.quickconnect_password, code)
|
||||
|
||||
class User(db.Model, UserMixin):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
username = db.Column(db.String(80), unique=True, nullable=False)
|
||||
password = db.Column(db.String(120), nullable=False)
|
||||
role = db.Column(db.String(80), nullable=False)
|
||||
theme = db.Column(db.String(80), default='light')
|
||||
|
||||
def set_password(self, password):
|
||||
self.password = bcrypt.generate_password_hash(password).decode('utf-8')
|
||||
|
||||
def check_password(self, password):
|
||||
return bcrypt.check_password_hash(self.password, password)
|
||||
|
||||
@property
|
||||
def is_active(self):
|
||||
return True
|
||||
|
||||
@property
|
||||
def is_authenticated(self):
|
||||
return True
|
||||
|
||||
@property
|
||||
def is_anonymous(self):
|
||||
return False
|
||||
|
||||
def get_id(self):
|
||||
return str(self.id)
|
||||
|
||||
# other models...
|
||||
Reference in New Issue
Block a user