mirror of
https://github.com/ION606/static-site-hosting.git
synced 2026-05-14 22:16:54 +00:00
c1f26094de
* split into files * attempted path fix * perms fix * added missed functions * fixed circular dependancy * I hate splitting * env fix * path fix
26 lines
852 B
Python
26 lines
852 B
Python
from . import db
|
|
from datetime import datetime
|
|
from flask_login import UserMixin
|
|
from werkzeug.security import generate_password_hash, check_password_hash
|
|
|
|
|
|
class User(UserMixin, db.Model):
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
email = db.Column(db.String(100), unique=True)
|
|
password_hash = db.Column(db.String(128))
|
|
|
|
def set_password(self, password):
|
|
self.password_hash = generate_password_hash(password)
|
|
|
|
def check_password(self, password):
|
|
return check_password_hash(self.password_hash, password)
|
|
|
|
|
|
class Site(db.Model):
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
user_id = db.Column(db.Integer)
|
|
name = db.Column(db.String(100))
|
|
subdomain = db.Column(db.String(100), unique=True)
|
|
last_accessed = db.Column(db.DateTime)
|
|
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|