-
Notifications
You must be signed in to change notification settings - Fork 0
/
Accounts.py
35 lines (32 loc) · 924 Bytes
/
Accounts.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
import ast
import os
import shutil
def Create(user,password):
try:
account_folder = 'Accounts/'+user
info_file = account_folder+'/info'
info = {'password':password,'projects':['']}
os.mkdir(account_folder)
with open(info_file,'w') as f:
f.write(str(info))
shutil.copy('profilepic.png',account_folder)
return True
except:
return False
def Login(user,password):
account_folder = 'Accounts/'+user
info_file = account_folder+'/info'
with open(info_file,'r') as f:
data = ast.literal_eval(f.read())
if(password == data['password']):
return True
return False
def Info(account):
try:
account_folder = 'Accounts/'+user
info_file = account_folder+'/info'
with open(info_file,'r') as f:
data = ast.literal_eval(f.read())
return data
except:
return {}