mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 18:01:36 +00:00
Use crypt for password hash on *nix
This commit is contained in:
11
src/gam.py
11
src/gam.py
@@ -52,7 +52,11 @@ from multiprocessing import Pool as mp_pool
|
||||
from multiprocessing import freeze_support as mp_freeze_support
|
||||
from multiprocessing import set_start_method as mp_set_start_method
|
||||
from urllib.parse import quote, urlencode, urlparse
|
||||
from passlib.hash import sha512_crypt
|
||||
try:
|
||||
from crypt import crypt
|
||||
except ImportError:
|
||||
# No crypt module on Win, use passlib
|
||||
from passlib.hash import crypt
|
||||
import dateutil.parser
|
||||
|
||||
import googleapiclient
|
||||
@@ -1512,9 +1516,6 @@ def addDelegates(users, i):
|
||||
print("Giving %s delegate access to %s (%s/%s)" % (delegate, delegator, i, count))
|
||||
gapi.call(gmail.users().settings().delegates(), 'create', soft_errors=True, userId='me', body={'delegateEmail': delegate})
|
||||
|
||||
def gen_sha512_hash(password):
|
||||
return sha512_crypt.hash(password, rounds=5000)
|
||||
|
||||
def printShowDelegates(users, csvFormat):
|
||||
if csvFormat:
|
||||
todrive = False
|
||||
@@ -7296,7 +7297,7 @@ def getUserAttributes(i, cd, updateCmd):
|
||||
rnd = SystemRandom()
|
||||
body['password'] = ''.join(rnd.choice(PASSWORD_SAFE_CHARS) for _ in range(100))
|
||||
if 'password' in body and need_to_hash_password:
|
||||
body['password'] = gen_sha512_hash(body['password'])
|
||||
body['password'] = crypt(body['password'])
|
||||
body['hashFunction'] = 'crypt'
|
||||
return body
|
||||
|
||||
|
||||
Reference in New Issue
Block a user