fix: re-read password hash from config in is_configured()
Avoid stale in-memory hash after password reset. Load from config each time.
This commit is contained in:
@@ -112,7 +112,22 @@ class AuthService:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def is_configured(self) -> bool:
|
def is_configured(self) -> bool:
|
||||||
return bool(self._hash)
|
# Always re-read from config to detect if reset happened
|
||||||
|
hash_val = None
|
||||||
|
try:
|
||||||
|
from src.server.services.config_service import get_config_service
|
||||||
|
config_service = get_config_service()
|
||||||
|
config = config_service.load_config()
|
||||||
|
hash_val = config.other.get('master_password_hash')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if isinstance(hash_val, str):
|
||||||
|
self._hash = hash_val
|
||||||
|
return True
|
||||||
|
# No hash in config - clear any stale in-memory hash
|
||||||
|
self._hash = None
|
||||||
|
return False
|
||||||
|
|
||||||
def setup_master_password(self, password: str) -> str:
|
def setup_master_password(self, password: str) -> str:
|
||||||
"""Set the master password (hash and store in memory/settings).
|
"""Set the master password (hash and store in memory/settings).
|
||||||
|
|||||||
Reference in New Issue
Block a user