From f83cf8d25eeb69881b6a6f570f1b4d35f23398b8 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Fri, 24 May 2024 13:37:56 -0700 Subject: [PATCH 1/2] reset fail count after error window --- net/server/internal/api_setAdminAccess.go | 2 +- net/server/internal/api_setAdminMFAuth.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/server/internal/api_setAdminAccess.go b/net/server/internal/api_setAdminAccess.go index 8e7a5793f..30426a4f8 100644 --- a/net/server/internal/api_setAdminAccess.go +++ b/net/server/internal/api_setAdminAccess.go @@ -61,7 +61,7 @@ func SetAdminAccess(w http.ResponseWriter, r *http.Request) { if res := tx.Clauses(clause.OnConflict{ Columns: []clause.Column{{Name: "config_id"}}, DoUpdates: clause.AssignmentColumns([]string{"num_value"}), - }).Create(&store.Config{ConfigID: CNFMFAFailedCount, NumValue: failedCount + 1}).Error; res != nil { + }).Create(&store.Config{ConfigID: CNFMFAFailedCount, NumValue: 1}).Error; res != nil { return res } } diff --git a/net/server/internal/api_setAdminMFAuth.go b/net/server/internal/api_setAdminMFAuth.go index 333b6e4a9..66ebd516a 100644 --- a/net/server/internal/api_setAdminMFAuth.go +++ b/net/server/internal/api_setAdminMFAuth.go @@ -59,7 +59,7 @@ func SetAdminMFAuth(w http.ResponseWriter, r *http.Request) { if res := tx.Clauses(clause.OnConflict{ Columns: []clause.Column{{Name: "config_id"}}, DoUpdates: clause.AssignmentColumns([]string{"num_value"}), - }).Create(&store.Config{ConfigID: CNFMFAFailedCount, NumValue: failedCount + 1}).Error; res != nil { + }).Create(&store.Config{ConfigID: CNFMFAFailedCount, NumValue: 1}).Error; res != nil { return res } } From 2804de99727a401414421f88cc172eb7f923c34a Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Fri, 24 May 2024 15:03:28 -0700 Subject: [PATCH 2/2] hide mfa option if using older server --- app/mobile/src/session/settings/Settings.jsx | 56 +++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/app/mobile/src/session/settings/Settings.jsx b/app/mobile/src/session/settings/Settings.jsx index e7b3d9f7d..b60ddc1c4 100644 --- a/app/mobile/src/session/settings/Settings.jsx +++ b/app/mobile/src/session/settings/Settings.jsx @@ -225,18 +225,20 @@ export function Settings({ drawer }) { - - - - - - - { state.strings.mfaTitle } - - - - + { state.mfaEnabled != null && ( + + + + + + + { state.strings.mfaTitle } + + + + + )} @@ -392,19 +394,23 @@ export function Settings({ drawer }) { { state.strings.logout } - - - - - - - - { state.strings.mfaTitle } - - - - + { state.mfaEnabled != null && ( + + )} + { state.mfaEnabled != null && ( + + + + + + + { state.strings.mfaTitle } + + + + + )}