swap-fix #78
| @ -630,21 +630,11 @@ func (h *MenuHandlers) incrementIncorrectPINAttempts(ctx context.Context, sessio | |||||||
| // resetIncorrectPINAttempts resets the number of incorrect PIN attempts after a correct PIN entry
 | // resetIncorrectPINAttempts resets the number of incorrect PIN attempts after a correct PIN entry
 | ||||||
| func (h *MenuHandlers) resetIncorrectPINAttempts(ctx context.Context, sessionId string) error { | func (h *MenuHandlers) resetIncorrectPINAttempts(ctx context.Context, sessionId string) error { | ||||||
| 	store := h.userdataStore | 	store := h.userdataStore | ||||||
| 	currentWrongPinAttempts, err := store.ReadEntry(ctx, sessionId, storedb.DATA_INCORRECT_PIN_ATTEMPTS) | 	err := store.WriteEntry(ctx, sessionId, storedb.DATA_INCORRECT_PIN_ATTEMPTS, []byte(string("0"))) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		if db.IsNotFound(err) { | 		logg.ErrorCtxf(ctx, "failed to reset incorrect PIN attempts ", "key", storedb.DATA_INCORRECT_PIN_ATTEMPTS, "error", err) | ||||||
| 			return nil |  | ||||||
| 		} |  | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 	currentWrongPinAttemptsCount, _ := strconv.ParseUint(string(currentWrongPinAttempts), 0, 64) |  | ||||||
| 	if currentWrongPinAttemptsCount <= uint64(pin.AllowedPINAttempts) { |  | ||||||
| 		err = store.WriteEntry(ctx, sessionId, storedb.DATA_INCORRECT_PIN_ATTEMPTS, []byte(string("0"))) |  | ||||||
| 		if err != nil { |  | ||||||
| 			logg.ErrorCtxf(ctx, "failed to reset incorrect PIN attempts ", "key", storedb.DATA_INCORRECT_PIN_ATTEMPTS, "value", pin.AllowedPINAttempts, "error", err) |  | ||||||
| 			return err |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user