Merge remote-tracking branch 'refs/remotes/origin/menu-traversals' into menu-traversals

This commit is contained in:
Carlosokumu 2024-10-02 13:54:00 +03:00
commit 7f6405d356
Signed by untrusted user: carlos
GPG Key ID: 7BD6BC8160A5C953
24 changed files with 51 additions and 63 deletions

View File

@ -241,6 +241,7 @@ func (h *Handlers) SaveTemporaryPin(ctx context.Context, sym string, input []byt
accountPIN := string(input)
if accountPIN != "0" { // for the 0:Back case
// Validate that the PIN is a 4-digit number
if !isValidPIN(accountPIN) {
res.FlagSet = append(res.FlagSet, flag_incorrect_pin)
@ -251,11 +252,13 @@ func (h *Handlers) SaveTemporaryPin(ctx context.Context, sym string, input []byt
if err != nil {
return res, err
}
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
vouchers := []string{
"SRF",
@ -286,9 +289,9 @@ func (h *Handlers) GetVoucherList(ctx context.Context,sym string,input []byte) (
for i, voucher := range vouchers {
numberedVouchers = append(numberedVouchers, fmt.Sprintf("%d:%s", i+1, voucher))
}
res.Content = strings.Join(numberedVouchers,"\n")
res.Content = strings.Join(numberedVouchers, "\n")
return res,nil
return res, nil
}
func (h *Handlers) ConfirmPinChange(ctx context.Context, sym string, input []byte) (resource.Result, error) {
@ -577,7 +580,7 @@ func (h *Handlers) Authorize(ctx context.Context, sym string, input []byte) (res
if err != nil {
return res, err
}
if len(input) == 4 {
if len(input) > 1 {
if bytes.Equal(input, AccountPin) {
if h.st.MatchFlag(flag_account_authorized, false) {
res.FlagReset = append(res.FlagReset, flag_incorrect_pin)

View File

@ -2,6 +2,4 @@ CATCH invalid_pin flag_valid_pin 0
MOUT back 0
HALT
INCMP _ 0
INCMP * pin_reset_success
INCMP pin_reset_success *

View File

@ -7,6 +7,3 @@ HALT
RELOAD save_firstname
INCMP _ 0
INCMP pin_entry *

View File

@ -1 +1,2 @@
PIN mpya na udhibitisho wa pin mpya hazilingani.Tafadhali jaribu tena.Kwa usaidizi piga simu +254757628885.
PIN mpya na udhibitisho wa PIN mpya hazilingani. Tafadhali jaribu tena.
Kwa usaidizi piga simu +254757628885.

View File

@ -4,6 +4,3 @@ MOUT back 0
HALT
INCMP _ 0
INCMP select_voucher 1

View File

@ -1 +1 @@
Enter a new four number pin
Enter a new four number PIN

View File

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

View File

@ -1,2 +1 @@
Weka PIN mpya ya nne nambari:

View File

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

View File

@ -5,4 +5,3 @@ MOUT back 0
HALT
INCMP _ 0
INCMP old_pin 1

View File

@ -3,4 +3,3 @@ MOUT quit 9
HALT
INCMP confirm_pin_change 1
INCMP quit 9

View File

@ -6,5 +6,3 @@ MOUT quit 9
HALT
INCMP main 0
INCMP quit 9

View File

@ -9,5 +9,3 @@ HALT
RELOAD save_gender
INCMP _ 0
INCMP pin_entry *

View File

@ -188,19 +188,19 @@
},
{
"input": "1",
"expectedContent": "Enter your old PIN\n\n0:Back"
"expectedContent": "Enter your old PIN\n0:Back"
},
{
"input": "1234",
"expectedContent": "Enter a new four number pin\n\n0:Back"
"expectedContent": "Enter a new four number pin\n0:Back"
},
{
"input": "1234",
"expectedContent": "Confirm your new PIN:\n\n0:Back"
"expectedContent": "Confirm your new PIN:\n0:Back"
},
{
"input": "1234",
"expectedContent": "Your PIN change request has been successful\n\n0:Back\n9:Quit"
"expectedContent": "Your PIN change request has been successful\n0:Back\n9:Quit"
},
{
"input": "9",
@ -288,7 +288,7 @@
},
{
"input": "1234",
"expectedContent": "Profile updated successfully\n\n0:Back\n9:Quit"
"expectedContent": "Profile updated successfully\n0:Back\n9:Quit"
},
{
"input": "9",
@ -322,7 +322,7 @@
},
{
"input": "1234",
"expectedContent": "Profile updated successfully\n\n0:Back\n9:Quit"
"expectedContent": "Profile updated successfully\n0:Back\n9:Quit"
},
{
"input": "9",
@ -356,7 +356,7 @@
},
{
"input": "1234",
"expectedContent": "Profile updated successfully\n\n0:Back\n9:Quit"
"expectedContent": "Profile updated successfully\n0:Back\n9:Quit"
},
{
"input": "9",
@ -390,7 +390,7 @@
},
{
"input": "1234",
"expectedContent": "Profile updated successfully\n\n0:Back\n9:Quit"
"expectedContent": "Profile updated successfully\n0:Back\n9:Quit"
},
{
"input": "9",
@ -424,7 +424,7 @@
},
{
"input": "1234",
"expectedContent": "Profile updated successfully\n\n0:Back\n9:Quit"
"expectedContent": "Profile updated successfully\n0:Back\n9:Quit"
},
{
"input": "9",
@ -458,7 +458,7 @@
},
{
"input": "1234",
"expectedContent": "Profile updated successfully\n\n0:Back\n9:Quit"
"expectedContent": "Profile updated successfully\n0:Back\n9:Quit"
},
{
"input": "9",