use a different key for the suggested aliases #47
| @ -2530,7 +2530,7 @@ func (h *MenuHandlers) RequestCustomAlias(ctx context.Context, sym string, input | |||||||
| 		alias := aliasResult.Alias | 		alias := aliasResult.Alias | ||||||
| 
 | 
 | ||||||
| 		//Store the returned alias,wait for user to confirm it as new account 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 { | 		if err != nil { | ||||||
| 			logg.ErrorCtxf(ctx, "failed to write account alias", "key", storedb.DATA_TEMPORARY_VALUE, "value", alias, "error", err) | 			logg.ErrorCtxf(ctx, "failed to write account alias", "key", storedb.DATA_TEMPORARY_VALUE, "value", alias, "error", err) | ||||||
| 			return res, err | 			return res, err | ||||||
| @ -2559,7 +2559,7 @@ func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input | |||||||
| 	if !ok { | 	if !ok { | ||||||
| 		return res, fmt.Errorf("missing session") | 		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 { | 	if err != nil { | ||||||
| 		return res, nil | 		return res, nil | ||||||
| 	} | 	} | ||||||
| @ -2567,7 +2567,7 @@ func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input | |||||||
| 	return res, nil | 	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) { | func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) { | ||||||
| 	var res resource.Result | 	var res resource.Result | ||||||
| 	store := h.userdataStore | 	store := h.userdataStore | ||||||
| @ -2578,7 +2578,7 @@ func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input [] | |||||||
| 	if !ok { | 	if !ok { | ||||||
| 		return res, fmt.Errorf("missing session") | 		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 { | 	if err != nil { | ||||||
| 		return res, nil | 		return res, nil | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -63,6 +63,8 @@ const ( | |||||||
| 	DATA_INITIAL_LANGUAGE_CODE | 	DATA_INITIAL_LANGUAGE_CODE | ||||||
| 	//Fully qualified account alias string
 | 	//Fully qualified account alias string
 | ||||||
| 	DATA_ACCOUNT_ALIAS | 	DATA_ACCOUNT_ALIAS | ||||||
|  | 	//currently suggested alias by the api awaiting user's confirmation as accepted account alias
 | ||||||
|  | 	DATA_SUGGESTED_ALIAS | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const ( | const ( | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user