def SetPassword(user):
 print 'Please enter your password twice to reset:'
 pwd = getpass.getpass()
 pwd2 = getpass.getpass()
 assert (pwd == pwd2), "passwords don't match"
 version = _CURRENT_PASSWORD_VERSION
 salt = _GenerateSalt(version)
 hashed = _HashPassword(pwd, version, salt)
 data = dict(salt=salt, hashed=hashed, version=version)
 secrets.PutSecret(_PasswordName(user), json.dumps(data))

def SetPassword ( user ) : print 'Please enter your password twice to reset:' pwd = getpass . getpass ( ) pwd2 = getpass . getpass ( ) assert ( pwd == pwd2 ) , "passwords don't match" version = _CURRENT_PASSWORD_VERSION salt = _GenerateSalt ( version ) hashed = _HashPassword ( pwd , version , salt ) data = dict ( salt = salt , hashed = hashed , version = version ) secrets . PutSecret ( _PasswordName ( user ) , json . dumps ( data ) )
accepts a user password as input from stdin and stores it to the secrets database .