Skip to content

Commit 4854332

Browse files
committed
initial
1 parent 53e24a2 commit 4854332

File tree

6 files changed

+44
-0
lines changed

6 files changed

+44
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
main.py
2+
templates/

__pycache__/app.cpython-39.pyc

957 Bytes
Binary file not shown.

app2.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import threading
2+
import time
3+
def myloop(rangenum:int):
4+
for i in range(rangenum):
5+
print(i)
6+
time.sleep(1)
7+
if i== rangenum-1:
8+
print("I AM Finished")
9+
t1=threading.Thread(target=myloop,args=(10,))
10+
t2=threading.Thread(target=myloop,args=(20,))
11+
t1.start()
12+
t2.start()

application.py

Whitespace-only changes.

myapp.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from peewee import *
2+
import datetime,hashlib,secrets
3+
db=SqliteDatabase('mydata.db')
4+
SALT="12ewdfer4t43refer4egtr55-3453498098134!2509680mysalt@"
5+
def secure_pass(password:str):
6+
return hashlib.pbkdf2_hmac('sha256',password.encode(),SALT.encode(),12000).hex()
7+
class Baseclass(Model):
8+
class Meta:
9+
database=db
10+
class User(Baseclass):
11+
username=CharField(primary_key=True,max_length=100)
12+
password=CharField()
13+
email=CharField(unique=True,null=True)
14+
created_at=DateTimeField(default=datetime.datetime.now())
15+
@classmethod
16+
def new_user(self,username,password):
17+
User.create(username=username,password=secure_pass(password))
18+
@classmethod
19+
def resetpassword(self,username):
20+
newpass=secrets.token_hex(16)
21+
User.update(password=secure_pass(newpass)).where(User.username==username).execute()
22+
return newpass
23+
class payment(Baseclass):
24+
id=AutoField()
25+
method=CharField()
26+
created_at=DateTimeField(default=datetime.datetime.now())
27+
amount=IntegerField()
28+
29+
30+
db.create_tables([User,payment],safe=True)

mydata.db

44 KB
Binary file not shown.

0 commit comments

Comments
 (0)