Commit b00b9be
committed
Fix TOTP encryption key file path resolution
- Changed `backend/models/user.py` to resolve `totp_encryption.key` using an absolute path relative to the `backend` directory.
- This prevents "Failed to decrypt TOTP secret" errors when the application is started from different working directories (e.g., project root vs backend root), ensuring consistent key loading.
- Added validation when reading the key file to ensure it is a valid Fernet key.
- Improved error logging in `_decrypt_totp_secret` to provide specific exception details for debugging.1 parent 2918ccd commit b00b9be
1 file changed
Lines changed: 25 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
44 | 57 | | |
45 | 58 | | |
46 | 59 | | |
47 | | - | |
48 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
49 | 66 | | |
50 | 67 | | |
51 | 68 | | |
| |||
58 | 75 | | |
59 | 76 | | |
60 | 77 | | |
61 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
62 | 82 | | |
63 | 83 | | |
64 | 84 | | |
| |||
0 commit comments