Initial commit
This commit is contained in:
commit
315e731234
27 changed files with 3403 additions and 0 deletions
24
user.py
Normal file
24
user.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import os
|
||||
from flask_login import UserMixin
|
||||
|
||||
|
||||
class User(UserMixin):
|
||||
def __init__(self, username):
|
||||
self.id = username
|
||||
self.username = username
|
||||
|
||||
@staticmethod
|
||||
def get(username):
|
||||
admin_username = os.getenv('ADMIN_USERNAME', 'admin')
|
||||
if username == admin_username:
|
||||
return User(username)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def authenticate(username, password):
|
||||
admin_username = os.getenv('ADMIN_USERNAME', 'admin')
|
||||
admin_password = os.getenv('ADMIN_PASSWORD', 'password')
|
||||
|
||||
if username == admin_username and password == admin_password:
|
||||
return User(username)
|
||||
return None
|
||||
Loading…
Add table
Add a link
Reference in a new issue