Ensure that the user sets a PIN before proceeding to main
This commit is contained in:
parent
2a5f7517f4
commit
1d578209fc
@ -43,7 +43,7 @@ func main() {
|
|||||||
state.FlagDebugger.Register(models.USERFLAG_INCORRECTDATEFORMAT,"INVALIDDATEFORMAT")
|
state.FlagDebugger.Register(models.USERFLAG_INCORRECTDATEFORMAT,"INVALIDDATEFORMAT")
|
||||||
state.FlagDebugger.Register(models.USERFLAG_INVALID_RECIPIENT,"INVALIDRECIPIENT")
|
state.FlagDebugger.Register(models.USERFLAG_INVALID_RECIPIENT,"INVALIDRECIPIENT")
|
||||||
state.FlagDebugger.Register(models.USERFLAG_PINMISMATCH,"PINMISMATCH")
|
state.FlagDebugger.Register(models.USERFLAG_PINMISMATCH,"PINMISMATCH")
|
||||||
state.FlagDebugger.Register(models.USERFLAG_QUERYPIN,"QUERYPIN")
|
state.FlagDebugger.Register(models.USERFLAG_PIN_SET,"PIN_SET")
|
||||||
state.FlagDebugger.Register(models.USERFLAG_INVALID_RECIPIENT_WITH_INVITE,"INVALIDRECIPIENT_WITH_INVITE")
|
state.FlagDebugger.Register(models.USERFLAG_INVALID_RECIPIENT_WITH_INVITE,"INVALIDRECIPIENT_WITH_INVITE")
|
||||||
state.FlagDebugger.Register(models.USERFLAG_INVALID_AMOUNT,"INVALIDAMOUNT")
|
state.FlagDebugger.Register(models.USERFLAG_INVALID_AMOUNT,"INVALIDAMOUNT")
|
||||||
state.FlagDebugger.Register(models.USERFLAG_UNLOCKFORUPDATE,"UNLOCKFORUPDATE")
|
state.FlagDebugger.Register(models.USERFLAG_UNLOCKFORUPDATE,"UNLOCKFORUPDATE")
|
||||||
|
@ -61,6 +61,13 @@ func (h *Handlers) CreateAccount(ctx context.Context, sym string, input []byte)
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if an account exists, set the flag and return
|
||||||
|
existingAccountData, err := h.accountFileHandler.ReadAccountData()
|
||||||
|
if existingAccountData != nil {
|
||||||
|
res.FlagSet = append(res.FlagSet, models.USERFLAG_ACCOUNT_CREATED)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
accountResp, err := server.CreateAccount()
|
accountResp, err := server.CreateAccount()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.FlagSet = append(res.FlagSet, models.USERFLAG_ACCOUNT_CREATION_FAILED)
|
res.FlagSet = append(res.FlagSet, models.USERFLAG_ACCOUNT_CREATION_FAILED)
|
||||||
@ -119,6 +126,7 @@ func (h *Handlers) VerifyPin(ctx context.Context, sym string, input []byte) (res
|
|||||||
if bytes.Equal(input, []byte(accountData["AccountPIN"])) {
|
if bytes.Equal(input, []byte(accountData["AccountPIN"])) {
|
||||||
res.FlagSet = []uint32{models.USERFLAG_VALIDPIN}
|
res.FlagSet = []uint32{models.USERFLAG_VALIDPIN}
|
||||||
res.FlagReset = []uint32{models.USERFLAG_PINMISMATCH}
|
res.FlagReset = []uint32{models.USERFLAG_PINMISMATCH}
|
||||||
|
res.FlagSet = append(res.FlagSet, models.USERFLAG_PIN_SET)
|
||||||
} else {
|
} else {
|
||||||
res.FlagSet = []uint32{models.USERFLAG_PINMISMATCH}
|
res.FlagSet = []uint32{models.USERFLAG_PINMISMATCH}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ const (
|
|||||||
USERFLAG_INCORRECTPIN
|
USERFLAG_INCORRECTPIN
|
||||||
USERFLAG_UNLOCKFORUPDATE
|
USERFLAG_UNLOCKFORUPDATE
|
||||||
USERFLAG_INVALID_AMOUNT
|
USERFLAG_INVALID_AMOUNT
|
||||||
USERFLAG_QUERYPIN
|
USERFLAG_PIN_SET
|
||||||
USERFLAG_VALIDPIN
|
USERFLAG_VALIDPIN
|
||||||
USERFLAG_PINMISMATCH
|
USERFLAG_PINMISMATCH
|
||||||
USERFLAG_INCORRECTDATEFORMAT
|
USERFLAG_INCORRECTDATEFORMAT
|
||||||
|
@ -3,4 +3,5 @@ CATCH account_creation_failed 22 1
|
|||||||
MOUT exit 0
|
MOUT exit 0
|
||||||
HALT
|
HALT
|
||||||
LOAD save_pin 0
|
LOAD save_pin 0
|
||||||
|
INCMP quit 0
|
||||||
INCMP confirm_create_pin *
|
INCMP confirm_create_pin *
|
||||||
|
@ -2,5 +2,6 @@ CATCH select_language 8 0
|
|||||||
CATCH terms 9 0
|
CATCH terms 9 0
|
||||||
LOAD check_account_status 0
|
LOAD check_account_status 0
|
||||||
CATCH account_pending 10 1
|
CATCH account_pending 10 1
|
||||||
|
CATCH create_pin 18 0
|
||||||
CATCH main 11 1
|
CATCH main 11 1
|
||||||
HALT
|
HALT
|
||||||
|
@ -4,4 +4,4 @@ MOUT yes 0
|
|||||||
MOUT no 1
|
MOUT no 1
|
||||||
HALT
|
HALT
|
||||||
INCMP create_pin 0
|
INCMP create_pin 0
|
||||||
INCMP _ *
|
INCMP quit *
|
||||||
|
Loading…
Reference in New Issue
Block a user