Harden login, sessions, and media access before the dev deploy.
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Successful in 47s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 15s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 5m43s
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Successful in 47s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 15s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 5m43s
Limit brute-force attempts, require admin TOTP, and keep session tokens out of media URLs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6c7c24e887
commit
32b28a93f3
31 files changed
+1146
-101
No files matched your search
@@ -10,6 +10,7 @@ import {
|
||||
import api, { ACTIVE_CLUB_STORAGE_KEY } from '../utils/api'
|
||||
import { activeClubMemberships } from '../utils/activeClub'
|
||||
import { clearCoachSessionStorage } from '../utils/trainingPlanUtils'
|
||||
import { clearMediaGrant, refreshMediaGrant } from '../utils/exerciseMediaUrl'
|
||||
|
||||
const AuthContext = createContext(null)
|
||||
|
||||
@@ -63,9 +64,25 @@ export function AuthProvider({ children }) {
|
||||
const profile = await api.getCurrentProfile()
|
||||
syncStoredActiveClub(profile)
|
||||
setUser(profile)
|
||||
refreshMediaGrant().catch(() => {})
|
||||
} catch (err) {
|
||||
try {
|
||||
const status = await api.getTotpStatus()
|
||||
if (status?.enrollment_required && !status?.totp_enabled) {
|
||||
setUser({
|
||||
totpEnrollmentRequired: true,
|
||||
email: status.email || null,
|
||||
role: status.role || null,
|
||||
})
|
||||
return
|
||||
}
|
||||
} catch {
|
||||
/* kein Einrichtungs-Token */
|
||||
}
|
||||
console.error('Auth check failed:', err)
|
||||
localStorage.removeItem('authToken')
|
||||
clearMediaGrant()
|
||||
setUser(null)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
@@ -132,6 +149,7 @@ export function AuthProvider({ children }) {
|
||||
setUser(null)
|
||||
localStorage.removeItem('authToken')
|
||||
localStorage.removeItem(ACTIVE_CLUB_STORAGE_KEY)
|
||||
clearMediaGrant()
|
||||
clearCoachSessionStorage()
|
||||
}, [])
|
||||
|
||||
|
||||
Reference in new issue
Block a user