From a11ca2a618ea4f7aa4a162ce949f4d7d2c7bd4ee Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Fri, 4 Apr 2025 12:05:04 +0300 Subject: [PATCH] reset the flag_language_set and flag_account_created flags if the publicKey does not exist on the db --- handlers/application/menuhandler.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/handlers/application/menuhandler.go b/handlers/application/menuhandler.go index 3077ef2..3378bb0 100644 --- a/handlers/application/menuhandler.go +++ b/handlers/application/menuhandler.go @@ -245,6 +245,7 @@ func (h *MenuHandlers) CreateAccount(ctx context.Context, sym string, input []by func (h *MenuHandlers) CheckAccountCreated(ctx context.Context, sym string, input []byte) (resource.Result, error) { var res resource.Result + flag_language_set, _ := h.flagManager.GetFlag("flag_language_set") flag_account_created, _ := h.flagManager.GetFlag("flag_account_created") store := h.userdataStore @@ -256,11 +257,17 @@ func (h *MenuHandlers) CheckAccountCreated(ctx context.Context, sym string, inpu _, err := store.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY) if err != nil { - if !db.IsNotFound(err) { - return res, err + if db.IsNotFound(err) { + // reset major flags + res.FlagReset = append(res.FlagReset, flag_language_set) + res.FlagReset = append(res.FlagReset, flag_account_created) + + return res, nil } + return res, nil } + res.FlagSet = append(res.FlagSet, flag_account_created) return res, nil }