-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.py
36 lines (28 loc) · 1003 Bytes
/
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
from google.appengine.ext import db
import hashlib
class User(db.Model):
email = db.StringProperty('Email')
password = db.StringProperty('Password')
type = db.StringProperty('Type')
def generateTestData(self):
q = db.GqlQuery("SELECT * FROM User")
results = q.fetch(1000)
while results:
db.delete(results)
results = q.fetch(1000, len(results))
salt="swh4cks"
tempPs = "123"
passWord = getHash(tempPs)
u = User(email='[email protected]', password=passWord, type="Administrator")
u.put()
tempPs = "password"
passWord = getHash(tempPs)
u = User(email='[email protected]', password=passWord, type="Administrator")
u.put()
tempPs = "hello"
passWord = getHash(tempPs)
u = User(email='[email protected]', password=passWord, type="Staff")
u.put()
def getHash(strToHash):
salt = "swh4cks"
return hashlib.md5(strToHash+salt).hexdigest()