diff --git a/handlers/application/menuhandler.go b/handlers/application/menuhandler.go index b55569e..f2eadd6 100644 --- a/handlers/application/menuhandler.go +++ b/handlers/application/menuhandler.go @@ -312,6 +312,8 @@ func (h *MenuHandlers) CheckBlockedStatus(ctx context.Context, sym string, input return res, fmt.Errorf("missing session") } + res.FlagReset = append(res.FlagReset, flag_account_pin_reset) + selfPinReset, err := store.ReadEntry(ctx, sessionId, storedb.DATA_SELF_PIN_RESET) if err == nil { pinResetValue, _ := strconv.ParseUint(string(selfPinReset), 0, 64) @@ -529,6 +531,7 @@ func (h *MenuHandlers) ConfirmPinChange(ctx context.Context, sym string, input [ return res, fmt.Errorf("missing session") } flag_pin_mismatch, _ := h.flagManager.GetFlag("flag_pin_mismatch") + flag_account_pin_reset, _ := h.flagManager.GetFlag("flag_account_pin_reset") if string(input) == "0" { res.FlagReset = append(res.FlagReset, flag_pin_mismatch) @@ -560,10 +563,13 @@ func (h *MenuHandlers) ConfirmPinChange(ctx context.Context, sym string, input [ logg.ErrorCtxf(ctx, "failed to write DATA_ACCOUNT_PIN entry with", "key", storedb.DATA_ACCOUNT_PIN, "hashedPIN value", hashedTemporaryPin, "error", err) return res, err } - err = logdb.WriteLogEntry(ctx, sessionId, storedb.DATA_ACCOUNT_PIN, []byte(hashedTemporaryPin)) + // set the DATA_SELF_PIN_RESET as 0 + err = store.WriteEntry(ctx, sessionId, storedb.DATA_SELF_PIN_RESET, []byte("0")) if err != nil { - logg.DebugCtxf(ctx, "Failed to write hashed PIN db log entry", "key", storedb.DATA_ACCOUNT_PIN, "value", hashedTemporaryPin) + logg.ErrorCtxf(ctx, "failed to write DATA_SELF_PIN_RESET entry with", "key", storedb.DATA_SELF_PIN_RESET, "self PIN reset value", "0", "error", err) + return res, err } + res.FlagReset = append(res.FlagReset, flag_account_pin_reset) return res, nil }