Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Admin: the activity log says what a throttle pause was for, now that the password check names it itself (#118)

Duarte Santos4861c6aec7cb
diff --git a/frontend/src/lib/audit.js b/frontend/src/lib/audit.js
index ff30e3989..64cef9606 100644
--- a/frontend/src/lib/audit.js
+++ b/frontend/src/lib/audit.js
@@ -34,7 +34,7 @@ const LABELS = {
'auth.password.change': 'Changed their password',
'auth.password.remove': 'Removed their password',
'auth.password.reset': 'Used a reset code',
- // The sign-in throttle paused an address; `msg` says for what (password, signup, pair).
+ // The password throttle paused an address; `msg` says for what (password, signup).
'auth.throttled': 'Too many failed attempts from one address',
'admin.user.disable': 'Disabled an account',
'admin.user.enable': 'Re-enabled an account',
@@ -66,7 +66,9 @@ const REASONS = {
'unknown-name': 'no profile with a password has that name',
'step-up-failed': 'the passkey confirming a new password was rejected',
'reset-invalid': 'wrong or expired reset code',
- 'reset': 'too many wrong reset codes for one name'
+ // What an `auth.throttled` pause was for.
+ 'password': 'wrong passwords or reset codes',
+ 'signup': 'wrong invite codes on password signup'
}
export const auditReason = msg => REASONS[msg] || (msg ? String(msg) : '')
diff --git a/frontend/src/lib/audit.test.js b/frontend/src/lib/audit.test.js
index f8b95cc2a..c33a1031e 100644
--- a/frontend/src/lib/audit.test.js
+++ b/frontend/src/lib/audit.test.js
@@ -47,6 +47,10 @@ describe('auditReason', () => {
expect(auditReason(m).length).toBeGreaterThan(3)
}
})
+ it('says what a throttle pause was for, including the kind the server passes in a variable', () => {
+ expect(auditLine({ ev: 'auth.throttled', ok: false, msg: 'signup' }).sub).toMatch(/invite codes/)
+ expect(auditLine({ ev: 'auth.throttled', ok: false, msg: 'password' }).sub).toMatch(/wrong passwords/)
+ })
it('falls back to the raw code and tolerates none at all', () => {
expect(auditReason('brand-new-code')).toBe('brand-new-code')
expect(auditReason(undefined)).toBe('')