|
|
@ -436,11 +436,6 @@ func (h *MenuHandlers) CheckBlockedNumPinMisMatch(ctx context.Context, sym strin
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read hashedTemporaryPin entry with", "key", storedb.DATA_TEMPORARY_VALUE, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read hashedTemporaryPin entry with", "key", storedb.DATA_TEMPORARY_VALUE, "error", err)
|
|
|
|
return res, err
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(hashedTemporaryPin) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "hashedTemporaryPin is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if pin.VerifyPIN(string(hashedTemporaryPin), string(input)) {
|
|
|
|
if pin.VerifyPIN(string(hashedTemporaryPin), string(input)) {
|
|
|
|
res.FlagReset = append(res.FlagReset, flag_pin_mismatch)
|
|
|
|
res.FlagReset = append(res.FlagReset, flag_pin_mismatch)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -469,10 +464,6 @@ func (h *MenuHandlers) ConfirmPinChange(ctx context.Context, sym string, input [
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read hashedTemporaryPin entry with", "key", storedb.DATA_TEMPORARY_VALUE, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read hashedTemporaryPin entry with", "key", storedb.DATA_TEMPORARY_VALUE, "error", err)
|
|
|
|
return res, err
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(hashedTemporaryPin) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "hashedTemporaryPin is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if pin.VerifyPIN(string(hashedTemporaryPin), string(input)) {
|
|
|
|
if pin.VerifyPIN(string(hashedTemporaryPin), string(input)) {
|
|
|
|
res.FlagReset = append(res.FlagReset, flag_pin_mismatch)
|
|
|
|
res.FlagReset = append(res.FlagReset, flag_pin_mismatch)
|
|
|
@ -507,17 +498,13 @@ func (h *MenuHandlers) ResetOthersPin(ctx context.Context, sym string, input []b
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read blockedPhonenumber entry with", "key", storedb.DATA_BLOCKED_NUMBER, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read blockedPhonenumber entry with", "key", storedb.DATA_BLOCKED_NUMBER, "error", err)
|
|
|
|
return res, err
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
hashedTemporaryPin, err := store.ReadEntry(ctx, string(blockedPhonenumber), storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
hashedTmporaryPin, err := store.ReadEntry(ctx, string(blockedPhonenumber), storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read hashedTmporaryPin entry with", "key", storedb.DATA_TEMPORARY_VALUE, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read hashedTmporaryPin entry with", "key", storedb.DATA_TEMPORARY_VALUE, "error", err)
|
|
|
|
return res, err
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(hashedTemporaryPin) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "hashedTemporaryPin is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err = store.WriteEntry(ctx, string(blockedPhonenumber), storedb.DATA_ACCOUNT_PIN, []byte(hashedTemporaryPin))
|
|
|
|
err = store.WriteEntry(ctx, string(blockedPhonenumber), storedb.DATA_ACCOUNT_PIN, []byte(hashedTmporaryPin))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return res, err
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -650,11 +637,6 @@ func (h *MenuHandlers) VerifyCreatePin(ctx context.Context, sym string, input []
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read hashedTemporaryPin entry with", "key", storedb.DATA_TEMPORARY_VALUE, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to read hashedTemporaryPin entry with", "key", storedb.DATA_TEMPORARY_VALUE, "error", err)
|
|
|
|
return res, err
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(hashedTemporaryPin) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "hashedTemporaryPin is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if pin.VerifyPIN(string(hashedTemporaryPin), string(input)) {
|
|
|
|
if pin.VerifyPIN(string(hashedTemporaryPin), string(input)) {
|
|
|
|
res.FlagSet = []uint32{flag_valid_pin}
|
|
|
|
res.FlagSet = []uint32{flag_valid_pin}
|
|
|
|
res.FlagReset = []uint32{flag_pin_mismatch}
|
|
|
|
res.FlagReset = []uint32{flag_pin_mismatch}
|
|
|
@ -690,10 +672,6 @@ func (h *MenuHandlers) SaveFirstname(ctx context.Context, sym string, input []by
|
|
|
|
firstNameSet := h.st.MatchFlag(flag_firstname_set, true)
|
|
|
|
firstNameSet := h.st.MatchFlag(flag_firstname_set, true)
|
|
|
|
if allowUpdate {
|
|
|
|
if allowUpdate {
|
|
|
|
temporaryFirstName, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
temporaryFirstName, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if len(temporaryFirstName) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "temporaryFirstName is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_FIRST_NAME, []byte(temporaryFirstName))
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_FIRST_NAME, []byte(temporaryFirstName))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write firstName entry with", "key", storedb.DATA_FIRST_NAME, "value", temporaryFirstName, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write firstName entry with", "key", storedb.DATA_FIRST_NAME, "value", temporaryFirstName, "error", err)
|
|
|
@ -738,10 +716,6 @@ func (h *MenuHandlers) SaveFamilyname(ctx context.Context, sym string, input []b
|
|
|
|
|
|
|
|
|
|
|
|
if allowUpdate {
|
|
|
|
if allowUpdate {
|
|
|
|
temporaryFamilyName, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
temporaryFamilyName, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if len(temporaryFamilyName) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "temporaryFamilyName is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_FAMILY_NAME, []byte(temporaryFamilyName))
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_FAMILY_NAME, []byte(temporaryFamilyName))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write familyName entry with", "key", storedb.DATA_FAMILY_NAME, "value", temporaryFamilyName, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write familyName entry with", "key", storedb.DATA_FAMILY_NAME, "value", temporaryFamilyName, "error", err)
|
|
|
@ -812,10 +786,6 @@ func (h *MenuHandlers) SaveYob(ctx context.Context, sym string, input []byte) (r
|
|
|
|
|
|
|
|
|
|
|
|
if allowUpdate {
|
|
|
|
if allowUpdate {
|
|
|
|
temporaryYob, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
temporaryYob, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if len(temporaryYob) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "temporaryYob is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_YOB, []byte(temporaryYob))
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_YOB, []byte(temporaryYob))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write yob entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", temporaryYob, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write yob entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", temporaryYob, "error", err)
|
|
|
@ -855,10 +825,6 @@ func (h *MenuHandlers) SaveLocation(ctx context.Context, sym string, input []byt
|
|
|
|
|
|
|
|
|
|
|
|
if allowUpdate {
|
|
|
|
if allowUpdate {
|
|
|
|
temporaryLocation, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
temporaryLocation, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if len(temporaryLocation) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "temporaryLocation is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_LOCATION, []byte(temporaryLocation))
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_LOCATION, []byte(temporaryLocation))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write location entry with", "key", storedb.DATA_LOCATION, "value", temporaryLocation, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write location entry with", "key", storedb.DATA_LOCATION, "value", temporaryLocation, "error", err)
|
|
|
@ -900,10 +866,6 @@ func (h *MenuHandlers) SaveGender(ctx context.Context, sym string, input []byte)
|
|
|
|
|
|
|
|
|
|
|
|
if allowUpdate {
|
|
|
|
if allowUpdate {
|
|
|
|
temporaryGender, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
temporaryGender, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if len(temporaryGender) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "temporaryGender is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_GENDER, []byte(temporaryGender))
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_GENDER, []byte(temporaryGender))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write gender entry with", "key", storedb.DATA_GENDER, "value", gender, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write gender entry with", "key", storedb.DATA_GENDER, "value", gender, "error", err)
|
|
|
@ -945,10 +907,6 @@ func (h *MenuHandlers) SaveOfferings(ctx context.Context, sym string, input []by
|
|
|
|
|
|
|
|
|
|
|
|
if allowUpdate {
|
|
|
|
if allowUpdate {
|
|
|
|
temporaryOfferings, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
temporaryOfferings, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if len(temporaryOfferings) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "temporaryOfferings is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_OFFERINGS, []byte(temporaryOfferings))
|
|
|
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_OFFERINGS, []byte(temporaryOfferings))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write offerings entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", offerings, "error", err)
|
|
|
|
logg.ErrorCtxf(ctx, "failed to write offerings entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", offerings, "error", err)
|
|
|
@ -1546,8 +1504,6 @@ func (h *MenuHandlers) ValidateRecipient(ctx context.Context, sym string, input
|
|
|
|
AliasAddress, err = h.accountService.CheckAliasAddress(ctx, recipient)
|
|
|
|
AliasAddress, err = h.accountService.CheckAliasAddress(ctx, recipient)
|
|
|
|
if err == nil {
|
|
|
|
if err == nil {
|
|
|
|
AliasAddressResult = AliasAddress.Address
|
|
|
|
AliasAddressResult = AliasAddress.Address
|
|
|
|
} else {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to resolve alias", "alias", recipient, "error_alias_check", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//Perform a search for each search domain,break on first match
|
|
|
|
//Perform a search for each search domain,break on first match
|
|
|
@ -1557,8 +1513,6 @@ func (h *MenuHandlers) ValidateRecipient(ctx context.Context, sym string, input
|
|
|
|
if err == nil {
|
|
|
|
if err == nil {
|
|
|
|
AliasAddressResult = AliasAddress.Address
|
|
|
|
AliasAddressResult = AliasAddress.Address
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
} else {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to resolve alias", "alias", recipient, "error_alias_check", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1623,10 +1577,6 @@ func (h *MenuHandlers) InviteValidRecipient(ctx context.Context, sym string, inp
|
|
|
|
l.AddDomain("default")
|
|
|
|
l.AddDomain("default")
|
|
|
|
|
|
|
|
|
|
|
|
recipient, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
recipient, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if len(recipient) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "recipient is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
// TODO
|
|
|
|
// send an invitation SMS
|
|
|
|
// send an invitation SMS
|
|
|
@ -1745,10 +1695,6 @@ func (h *MenuHandlers) GetRecipient(ctx context.Context, sym string, input []byt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
store := h.userdataStore
|
|
|
|
store := h.userdataStore
|
|
|
|
recipient, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
recipient, _ := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
if len(recipient) == 0 {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "recipient is empty", "key", storedb.DATA_TEMPORARY_VALUE)
|
|
|
|
|
|
|
|
return res, fmt.Errorf("Data error encountered")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
res.Content = string(recipient)
|
|
|
|
res.Content = string(recipient)
|
|
|
|
|
|
|
|
|
|
|
@ -2370,7 +2316,6 @@ func (h *MenuHandlers) constructAccountAlias(ctx context.Context) error {
|
|
|
|
aliasInput := fmt.Sprintf("%s%s", firstName, familyName)
|
|
|
|
aliasInput := fmt.Sprintf("%s%s", firstName, familyName)
|
|
|
|
aliasResult, err := h.accountService.RequestAlias(ctx, string(pubKey), aliasInput)
|
|
|
|
aliasResult, err := h.accountService.RequestAlias(ctx, string(pubKey), aliasInput)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logg.ErrorCtxf(ctx, "failed to retrieve alias", "alias", aliasInput, "error_alias_request", err)
|
|
|
|
|
|
|
|
return fmt.Errorf("Failed to retrieve alias: %s", err.Error())
|
|
|
|
return fmt.Errorf("Failed to retrieve alias: %s", err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
alias = aliasResult.Alias
|
|
|
|
alias = aliasResult.Alias
|
|
|
@ -2382,20 +2327,3 @@ func (h *MenuHandlers) constructAccountAlias(ctx context.Context) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *MenuHandlers) ClearTemporaryValue(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
|
|
|
|
|
|
|
var res resource.Result
|
|
|
|
|
|
|
|
sessionId, ok := ctx.Value("SessionId").(string)
|
|
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
|
|
return res, fmt.Errorf("missing session")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
userStore := h.userdataStore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// clear the temporary value at the start
|
|
|
|
|
|
|
|
err := userStore.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(""))
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
logg.ErrorCtxf(ctx, "failed to clear DATA_TEMPORARY_VALUE entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", "empty", "error", err)
|
|
|
|
|
|
|
|
return res, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return res, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|