forked from Apenas-Gabriel/Webadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.py
42 lines (33 loc) · 1.28 KB
/
user.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from dbconsult import dbGenerate
import hashlib
class User:
def __init__(self):
self.db = dbGenerate()
def registerUser(self, user, email, password, ip):
if user and email and password:
status = self.db.registerUser(user, email, hashlib.md5(password.encode()).hexdigest(), ip)
if status == True:
self.user = user
self.password = hashlib.md5(password.encode()).hexdigest()
return status
def loginUser(self, user, password):
if user and password:
status = self.db.loginUser(user, hashlib.md5(password.encode()).hexdigest())
if status == True:
self.user = user
self.password = hashlib.md5(password.encode()).hexdigest()
return status
def getTokenInfo(self, user, game):
token = self.db.getLicenseInfos(user, game)
return token
def createLicense(self, user, game):
db.generateLicense(user, game)
def checkLicenseStatus(self):
return self.db.isLicenseValid()
def returnUserLogin(self):
if self.user:
return self.user
else:
return False
def savePayment(self, user, pid, pmethod,status):
self.db.registerPayment(user, pid, pmethod,status)