menu-traversals #108

Closed
carlos wants to merge 72 commits from menu-traversals into master
3 changed files with 24 additions and 22 deletions
Showing only changes of commit 948a9d3a93 - Show all commits

View File

@ -241,6 +241,7 @@ func (h *Handlers) SaveTemporaryPin(ctx context.Context, sym string, input []byt
accountPIN := string(input) accountPIN := string(input)
if accountPIN != "0" { // for the 0:Back case
// Validate that the PIN is a 4-digit number // Validate that the PIN is a 4-digit number
if !isValidPIN(accountPIN) { if !isValidPIN(accountPIN) {
res.FlagSet = append(res.FlagSet, flag_incorrect_pin) res.FlagSet = append(res.FlagSet, flag_incorrect_pin)
@ -254,6 +255,8 @@ func (h *Handlers) SaveTemporaryPin(ctx context.Context, sym string, input []byt
return res, nil return res, nil
} }
return res, nil
}
func (h *Handlers) GetVoucherList(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (h *Handlers) GetVoucherList(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result var res resource.Result
@ -577,7 +580,7 @@ func (h *Handlers) Authorize(ctx context.Context, sym string, input []byte) (res
if err != nil { if err != nil {
return res, err return res, err
} }
if len(input) == 4 { if len(input) > 1 {
if bytes.Equal(input, AccountPin) { if bytes.Equal(input, AccountPin) {
if h.st.MatchFlag(flag_account_authorized, false) { if h.st.MatchFlag(flag_account_authorized, false) {
res.FlagReset = append(res.FlagReset, flag_incorrect_pin) res.FlagReset = append(res.FlagReset, flag_incorrect_pin)

View File

@ -1,13 +1,10 @@
LOAD authorize_account 12 CATCH _ flag_allow_update 0
RELOAD authorize_account
CATCH incorrect_pin flag_incorrect_pin 1
CATCH old_pin flag_allow_update 0
MOUT back 0 MOUT back 0
HALT HALT
INCMP _ 0 INCMP _ 0
LOAD save_temporary_pin 6 LOAD save_temporary_pin 6
LOAD verify_new_pin 0
RELOAD save_temporary_pin RELOAD save_temporary_pin
LOAD verify_new_pin 8
RELOAD verify_new_pin RELOAD verify_new_pin
INCMP * confirm_pin_change CATCH incorrect_pin flag_incorrect_pin 1
INCMP confirm_pin_change *

View File

@ -1,7 +1,9 @@
LOAD reset_allow_update 0 LOAD reset_allow_update 0
RELOAD reset_allow_update
MOUT back 0 MOUT back 0
HALT HALT
RELOAD reset_allow_update LOAD authorize_account 12
RELOAD authorize_account
CATCH incorrect_pin flag_incorrect_pin 1
INCMP _ 0 INCMP _ 0
INCMP new_pin * INCMP new_pin *