mirror of
https://github.com/balzack/databag.git
synced 2025-02-11 19:19:16 +00:00
apply temporary lock only when mfa enabled
This commit is contained in:
parent
0001f6c8c9
commit
df8d2806e6
@ -26,14 +26,14 @@ func SetAdminAccess(w http.ResponseWriter, r *http.Request) {
|
||||
curTime := time.Now().Unix()
|
||||
failedTime := getNumConfigValue(CNFMFAFailedTime, 0);
|
||||
failedCount := getNumConfigValue(CNFMFAFailedCount, 0);
|
||||
if failedTime + APPMFAFailPeriod > curTime && failedCount > APPMFAFailCount {
|
||||
ErrResponse(w, http.StatusTooManyRequests, errors.New("temporarily locked"))
|
||||
return;
|
||||
}
|
||||
|
||||
mfaEnabled := getBoolConfigValue(CNFMFAEnabled, false);
|
||||
mfaConfirmed := getBoolConfigValue(CNFMFAConfirmed, false);
|
||||
if mfaEnabled && mfaConfirmed {
|
||||
if failedTime + APPMFAFailPeriod > curTime && failedCount > APPMFAFailCount {
|
||||
ErrResponse(w, http.StatusTooManyRequests, errors.New("temporarily locked"))
|
||||
return;
|
||||
}
|
||||
|
||||
code := r.FormValue("code")
|
||||
if code == "" {
|
||||
ErrResponse(w, http.StatusMethodNotAllowed, errors.New("totp code required"))
|
||||
|
Loading…
Reference in New Issue
Block a user