Clear the temporary value after use
This commit is contained in:
parent
0f2d6def23
commit
4155b267ee
@ -479,6 +479,13 @@ func (h *MenuHandlers) ConfirmPinChange(ctx context.Context, sym string, input [
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err = store.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
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,6 +522,13 @@ func (h *MenuHandlers) ResetOthersPin(ctx context.Context, sym string, input []b
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err = store.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
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,6 +695,12 @@ func (h *MenuHandlers) SaveFirstname(ctx context.Context, sym string, input []by
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err = store.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
|
||||||
|
}
|
||||||
res.FlagSet = append(res.FlagSet, flag_firstname_set)
|
res.FlagSet = append(res.FlagSet, flag_firstname_set)
|
||||||
} else {
|
} else {
|
||||||
if firstNameSet {
|
if firstNameSet {
|
||||||
@ -721,6 +741,12 @@ func (h *MenuHandlers) SaveFamilyname(ctx context.Context, sym string, input []b
|
|||||||
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)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err = store.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
|
||||||
|
}
|
||||||
res.FlagSet = append(res.FlagSet, flag_familyname_set)
|
res.FlagSet = append(res.FlagSet, flag_familyname_set)
|
||||||
} else {
|
} else {
|
||||||
if familyNameSet {
|
if familyNameSet {
|
||||||
@ -791,6 +817,12 @@ func (h *MenuHandlers) SaveYob(ctx context.Context, sym string, input []byte) (r
|
|||||||
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)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err = store.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
|
||||||
|
}
|
||||||
res.FlagSet = append(res.FlagSet, flag_yob_set)
|
res.FlagSet = append(res.FlagSet, flag_yob_set)
|
||||||
} else {
|
} else {
|
||||||
if yobSet {
|
if yobSet {
|
||||||
@ -830,6 +862,12 @@ func (h *MenuHandlers) SaveLocation(ctx context.Context, sym string, input []byt
|
|||||||
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)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err = store.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
|
||||||
|
}
|
||||||
res.FlagSet = append(res.FlagSet, flag_location_set)
|
res.FlagSet = append(res.FlagSet, flag_location_set)
|
||||||
} else {
|
} else {
|
||||||
if locationSet {
|
if locationSet {
|
||||||
@ -871,6 +909,12 @@ func (h *MenuHandlers) SaveGender(ctx context.Context, sym string, input []byte)
|
|||||||
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)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err = store.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
|
||||||
|
}
|
||||||
res.FlagSet = append(res.FlagSet, flag_gender_set)
|
res.FlagSet = append(res.FlagSet, flag_gender_set)
|
||||||
} else {
|
} else {
|
||||||
if genderSet {
|
if genderSet {
|
||||||
@ -912,6 +956,12 @@ func (h *MenuHandlers) SaveOfferings(ctx context.Context, sym string, input []by
|
|||||||
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)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err = store.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
|
||||||
|
}
|
||||||
res.FlagSet = append(res.FlagSet, flag_offerings_set)
|
res.FlagSet = append(res.FlagSet, flag_offerings_set)
|
||||||
} else {
|
} else {
|
||||||
if offeringsSet {
|
if offeringsSet {
|
||||||
@ -1584,6 +1634,12 @@ func (h *MenuHandlers) InviteValidRecipient(ctx context.Context, sym string, inp
|
|||||||
// res.Content = l.Get("Your invitation to %s to join Sarafu Network has been sent.", string(recipient))
|
// res.Content = l.Get("Your invitation to %s to join Sarafu Network has been sent.", string(recipient))
|
||||||
|
|
||||||
res.Content = l.Get("Your invite request for %s to Sarafu Network failed. Please try again later.", string(recipient))
|
res.Content = l.Get("Your invite request for %s to Sarafu Network failed. Please try again later.", string(recipient))
|
||||||
|
// clear the temporary value as it has been used
|
||||||
|
err := store.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
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user