Merge branch 'master' of github.com:jay0lee/GAM
This commit is contained in:
Jay Lee
2014-06-29 14:20:56 -04:00
74 changed files with 31286 additions and 8 deletions

20
gam.py
View File

@ -1046,6 +1046,10 @@ def doDelegates(users):
if delete_alias:
doDeleteAlias(alias_email=use_delegate_address)
def gen_sha512_hash(password):
from passlib.hash import sha512_crypt
return sha512_crypt(password)
def getDelegates(users):
emailsettings = getEmailSettingsObject()
csv_format = False
@ -3502,10 +3506,10 @@ def doCreateUser():
if need_password:
body[u'password'] = u''.join(random.sample(u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`!@#$%^&*()-=_+:;"\'{}[]\\|', 25))
if need_to_hash_password:
newhash = hashlib.sha1()
newhash.update(body[u'password'])
body[u'password'] = newhash.hexdigest()
body[u'hashFunction'] = u'SHA-1'
#newhash = hashlib.sha1()
#newhash.update(body[u'password'])
body[u'password'] = gen_sha512_hash(body[u'password'])
body[u'hashFunction'] = u'crypt'
print u"Creating account for %s" % body[u'primaryEmail']
callGAPI(service=cd.users(), function='insert', body=body)
if do_admin:
@ -3958,10 +3962,10 @@ def doUpdateUser(users):
print u'Error: didn\'t expect %s command at position %s' % (sys.argv[i], i)
sys.exit(2)
if gotPassword and not (isSHA1 or isMD5 or isCrypt or nohash):
newhash = hashlib.sha1()
newhash.update(body[u'password'])
body[u'password'] = newhash.hexdigest()
body[u'hashFunction'] = u'SHA-1'
#newhash = hashlib.sha1()
#newhash.update(body[u'password'])
body[u'password'] = gen_sha512_hash(body[u'password'])
body[u'hashFunction'] = u'crypt'
for user in users:
if user[:4].lower() == u'uid:':
user = user[4:]