|
|
|
@ -747,7 +747,7 @@ func (h *Handlers) Authorize(ctx context.Context, sym string, input []byte) (res
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
err := h.countIncorrectPINAttempts(ctx, sessionId)
|
|
|
|
|
err := h.incrementIncorrectPINAttempts(ctx, sessionId)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return res, err
|
|
|
|
|
}
|
|
|
|
@ -2124,8 +2124,8 @@ func (h *Handlers) UpdateAllProfileItems(ctx context.Context, sym string, input
|
|
|
|
|
return res, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// countIncorrectPINAttempts keeps track of the number of incorrect PIN attempts
|
|
|
|
|
func (h *Handlers) countIncorrectPINAttempts(ctx context.Context, sessionId string) error {
|
|
|
|
|
// incrementIncorrectPINAttempts keeps track of the number of incorrect PIN attempts
|
|
|
|
|
func (h *Handlers) incrementIncorrectPINAttempts(ctx context.Context, sessionId string) error {
|
|
|
|
|
var pinAttemptsCount uint8
|
|
|
|
|
store := h.userdataStore
|
|
|
|
|
|
|
|
|
@ -2163,8 +2163,8 @@ func (h *Handlers) resetIncorrectPINAttempts(ctx context.Context, sessionId stri
|
|
|
|
|
}
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
remainingPINAttempts, _ := strconv.ParseUint(string(currentWrongPinAttempts), 0, 64)
|
|
|
|
|
if remainingPINAttempts <= uint64(common.AllowedPINAttempts) {
|
|
|
|
|
currentWrongPinAttemptsCount, _ := strconv.ParseUint(string(currentWrongPinAttempts), 0, 64)
|
|
|
|
|
if currentWrongPinAttemptsCount <= uint64(common.AllowedPINAttempts) {
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, common.DATA_INCORRECT_PIN_ATTEMPTS, []byte(string("0")))
|
|
|
|
|
if err != nil {
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to reset incorrect PIN attempts ", "key", common.DATA_INCORRECT_PIN_ATTEMPTS, "value", common.AllowedPINAttempts, "error", err)
|
|
|
|
|