Skip to content

Commit

Permalink
Issue GENI-NSF#164: Fix commandline script to not create tutorial acc…
Browse files Browse the repository at this point in the history
…ounts with an email address
  • Loading branch information
ahelsing committed Jul 21, 2016
1 parent e1955b4 commit f88200c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions bin/geni-tutorial-accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,23 @@ def add_request(self,num,uprefix,phone,pwprefix,desc):
uname = "%s%s" %(uprefix,num)
org = "Tutorial"
title = "User"
email = "%[email protected]" %(uname)
# email = "%[email protected]" %(uname)

password = "%s%s" %(pwprefix,num)
salt = base64.urlsafe_b64encode(uuid.uuid4().bytes)
t_sha = hashlib.sha512()
t_sha.update(password+salt)
pw_hash = base64.urlsafe_b64encode(t_sha.digest())
# sql = ('INSERT into idp_account_request '
# + "(first_name,last_name,email,username_requested,phone,password_hash,organization,title,reason)"
# + " values ('%s','%s','%s','%s', '%s','%s','%s','%s', '%s');\n")

# fullsql = sql %(firstname,lastname,email,uname,phone,pw_hash,org,title,desc)
sql = ('INSERT into idp_account_request '
+ "(first_name,last_name,email,username_requested,phone,password_hash,organization,title,reason)"
+ " values ('%s','%s','%s','%s', '%s','%s','%s','%s', '%s');\n")
+ "(first_name,last_name,username_requested,phone,password_hash,organization,title,reason)"
+ " values ('%s','%s','%s', '%s','%s','%s','%s', '%s');\n")

fullsql = sql %(firstname,lastname,email,uname,phone,pw_hash,org,title,desc)
fullsql = sql %(firstname,lastname,uname,phone,pw_hash,org,title,desc)
print "%s" %fullsql

psql.stdin.write(fullsql)
Expand Down

0 comments on commit f88200c

Please sign in to comment.