first commit
This commit is contained in:
35
lib/framework/user.py
Normal file
35
lib/framework/user.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import os
|
||||
|
||||
|
||||
class User:
|
||||
def __init__(
|
||||
self, user_id, email=None, passwd_hash=None, authenticated=True
|
||||
):
|
||||
self.user_id = user_id
|
||||
self.email = email
|
||||
self.passwd_hash = passwd_hash
|
||||
self.authenticated = authenticated
|
||||
|
||||
def __repr__(self):
|
||||
r = {
|
||||
"user_id": self.user_id,
|
||||
"email": self.email,
|
||||
"passwd_hash": self.passwd_hash,
|
||||
"authenticated": self.authenticated,
|
||||
}
|
||||
return str(r)
|
||||
|
||||
def can_login(self, passwd_hash):
|
||||
return self.passwd_hash == passwd_hash
|
||||
|
||||
def is_active(self):
|
||||
return True
|
||||
|
||||
def get_id(self):
|
||||
return self.user_id
|
||||
|
||||
def is_authenticated(self):
|
||||
return self.authenticated
|
||||
|
||||
def is_anonymous(self):
|
||||
return False
|
||||
Reference in New Issue
Block a user