wip-account-creation #4

Merged
lash merged 143 commits from wip-account-creation into master 2024-08-30 14:37:58 +02:00
Showing only changes of commit d87b70b292 - Show all commits

View File

@ -130,10 +130,14 @@ func (h *Handlers) SetResetSingleEdit(ctx context.Context, sym string, input []b
switch menuOPtion { switch menuOPtion {
case "2": case "2":
fmt.Println("Resetting unlock for update")
res.FlagReset = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT) res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT)
case "3": case "3":
res.FlagReset = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT) res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT)
case "4": case "4":
res.FlagReset = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT) res.FlagSet = append(res.FlagSet, models.USERFLAG_SINGLE_EDIT)
default: default:
res.FlagReset = append(res.FlagReset, models.USERFLAG_SINGLE_EDIT) res.FlagReset = append(res.FlagReset, models.USERFLAG_SINGLE_EDIT)
@ -339,6 +343,8 @@ func (h *Handlers) CheckIdentifier(ctx context.Context, sym string, input []byte
return res, nil return res, nil
} }
Outdated
Review

"unlocked" risks being an ambiguous term when we introduce account blocking due to direct action or incorrect pin attempts. can we rename it please?

"unlocked" risks being an ambiguous term when we introduce account blocking due to direct action or incorrect pin attempts. can we rename it please?
// Unlock attempts to unlock the next sequential nodes by verifying the provided PIN against the already set PIN.
// It sets the required flags that control the flow.
func (h *Handlers) Unlock(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (h *Handlers) Unlock(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{} res := resource.Result{}
pin := string(input) pin := string(input)
@ -348,7 +354,7 @@ func (h *Handlers) Unlock(ctx context.Context, sym string, input []byte) (resour
return res, err return res, err
} }
if len(input) > 1 { if len(input) == 4 {
if pin != accountData["AccountPIN"] { if pin != accountData["AccountPIN"] {
res.FlagSet = append(res.FlagSet, models.USERFLAG_INCORRECTPIN) res.FlagSet = append(res.FlagSet, models.USERFLAG_INCORRECTPIN)
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED) res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
@ -359,6 +365,7 @@ func (h *Handlers) Unlock(ctx context.Context, sym string, input []byte) (resour
res.FlagSet = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE) res.FlagSet = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagSet = append(res.FlagSet, models.USERFLAG_ACCOUNT_UNLOCKED) res.FlagSet = append(res.FlagSet, models.USERFLAG_ACCOUNT_UNLOCKED)
} else { } else {
res.FlagSet = append(res.FlagSet, models.USERFLAG_UNLOCKFORUPDATE)
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED) res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
} }
} }
@ -662,6 +669,8 @@ func (h *Handlers) GetSender(ctx context.Context, sym string, input []byte) (res
return res, nil return res, nil
} }
// QuickWithBalance retrieves the balance for a given public key from the custodial balance API endpoint before
// gracefully exiting the session.
func (h *Handlers) QuitWithBalance(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (h *Handlers) QuitWithBalance(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{} res := resource.Result{}