mirror of
https://github.com/jackeilles/xygt.git
synced 2024-11-22 06:42:40 +01:00
23 lines
No EOL
753 B
Python
23 lines
No EOL
753 B
Python
from flask_login import UserMixin
|
|
from config import Config
|
|
|
|
class User(UserMixin):
|
|
def __init__(self, user, userid, password, idpass, level):
|
|
self.user = user
|
|
self.password = password
|
|
self.userid = userid
|
|
self.idpass = idpass
|
|
self.level = level
|
|
|
|
def __repr__(self):
|
|
return f"User('{self.user}', '{self.userid}', '{self.password}', '{self.idpass}', '{self.level}')"
|
|
|
|
def get_id(self):
|
|
return str(self.userid)
|
|
|
|
def get(self):
|
|
userData = Config.users.find_one({"userid": self})
|
|
if not userData:
|
|
return None
|
|
else:
|
|
return User(userData["user"], userData["userid"], userData["password"], userData["idpass"], userData["level"]) |