@@ -28,20 +28,23 @@ def get_crypt_key():
2828 :return: the key
2929 """
3030 enc_key = current_app .keyManager .get ()
31- # if desktop mode and master pass and local os secret is
32- # disabled then use the password hash
33- if not config .MASTER_PASSWORD_REQUIRED and \
34- not config .USE_OS_SECRET_STORAGE and not config .SERVER_MODE :
35- return True , current_user .password
36- # if desktop mode and master pass enabled
37- elif (config .MASTER_PASSWORD_REQUIRED or config .USE_OS_SECRET_STORAGE ) \
38- and enc_key is None :
39- return False , None
40- elif not config .MASTER_PASSWORD_REQUIRED and config .SERVER_MODE and \
41- 'pass_enc_key' in session :
42- return True , session ['pass_enc_key' ]
31+ if config .SERVER_MODE :
32+ if config .MASTER_PASSWORD_REQUIRED and enc_key is None :
33+ return False , None
34+ if 'pass_enc_key' in session :
35+ return True , session ['pass_enc_key' ]
4336 else :
44- return True , enc_key
37+ # if desktop mode and master pass and
38+ # local os secret is disabled then use the password hash
39+ if not config .MASTER_PASSWORD_REQUIRED and \
40+ not config .USE_OS_SECRET_STORAGE :
41+ return True , current_user .password
42+ # and master pass enabled or local os secret enabled
43+ # but enc key is none
44+ if (config .MASTER_PASSWORD_REQUIRED or config .USE_OS_SECRET_STORAGE ) \
45+ and enc_key is None :
46+ return False , None
47+ return True , enc_key
4548
4649
4750def get_master_password_key_from_os_secret ():
@@ -79,7 +82,7 @@ def validate_master_password(password):
7982 else :
8083 return True
8184 except Exception :
82- False
85+ return False
8386
8487
8588def set_masterpass_check_text (password , clear = False ):
0 commit comments