diff --git a/handlers/application/menuhandler.go b/handlers/application/menuhandler.go index 5cbea34..13d1315 100644 --- a/handlers/application/menuhandler.go +++ b/handlers/application/menuhandler.go @@ -2528,9 +2528,10 @@ func (h *MenuHandlers) RequestCustomAlias(ctx context.Context, sym string, input return res, fmt.Errorf("Failed to retrieve alias: %s", err.Error()) } alias := aliasResult.Alias + logg.InfoCtxf(ctx, "Suggested alias ", "alias", alias) //Store the returned alias,wait for user to confirm it as new account alias - err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(alias)) + err = store.WriteEntry(ctx, sessionId, storedb.DATA_SUGGESTED_ALIAS, []byte(alias)) if err != nil { logg.ErrorCtxf(ctx, "failed to write account alias", "key", storedb.DATA_TEMPORARY_VALUE, "value", alias, "error", err) return res, err @@ -2559,7 +2560,7 @@ func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input if !ok { return res, fmt.Errorf("missing session") } - suggestedAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE) + suggestedAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_SUGGESTED_ALIAS) if err != nil { return res, nil } @@ -2567,7 +2568,7 @@ func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input return res, nil } -// ConfirmNewAlias reads the suggested alias from the temporary value and confirms it as the new account alias. +// ConfirmNewAlias reads the suggested alias from the [DATA_SUGGECTED_ALIAS] key and confirms it as the new account alias. func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) { var res resource.Result store := h.userdataStore @@ -2578,10 +2579,11 @@ func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input [] if !ok { return res, fmt.Errorf("missing session") } - newAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE) + newAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_SUGGESTED_ALIAS) if err != nil { return res, nil } + logg.InfoCtxf(ctx, "Confirming new alias", "alias", string(newAlias)) err = store.WriteEntry(ctx, sessionId, storedb.DATA_ACCOUNT_ALIAS, []byte(string(newAlias))) if err != nil { logg.ErrorCtxf(ctx, "failed to clear DATA_ACCOUNT_ALIAS_VALUE entry with", "key", storedb.DATA_ACCOUNT_ALIAS, "value", "empty", "error", err) diff --git a/services/registration/my_account_alias b/services/registration/my_account_alias index 726f06b..4ab2e04 100644 --- a/services/registration/my_account_alias +++ b/services/registration/my_account_alias @@ -1,2 +1,2 @@ Current alias: {{.get_current_profile_info}} -Enter your preferred alias:: \ No newline at end of file +Enter your preferred alias: \ No newline at end of file diff --git a/services/registration/my_account_alias_swa b/services/registration/my_account_alias_swa index 0ea3166..3bd52a3 100644 --- a/services/registration/my_account_alias_swa +++ b/services/registration/my_account_alias_swa @@ -1,2 +1,2 @@ Lakabu ya sasa: {{.get_current_profile_info}} -Weka lakabu unalopendelea:: \ No newline at end of file +Weka lakabu unalopendelea: \ No newline at end of file diff --git a/store/db/db.go b/store/db/db.go index 73c9c5d..220ac56 100644 --- a/store/db/db.go +++ b/store/db/db.go @@ -63,6 +63,8 @@ const ( DATA_INITIAL_LANGUAGE_CODE //Fully qualified account alias string DATA_ACCOUNT_ALIAS + //currently suggested alias by the api awaiting user's confirmation as accepted account alias + DATA_SUGGESTED_ALIAS ) const (