Compare commits

..

No commits in common. "e2d5546de1dae1e0e2c52b5a7a682dee2d53cc27" and "d4fcf40b8d78e25813416269ca5b77c64a685087" have entirely different histories.

9 changed files with 14 additions and 27 deletions

View File

@ -318,7 +318,7 @@ func (h *MenuHandlers) VerifyNewPin(ctx context.Context, sym string, input []byt
return res, fmt.Errorf("missing session")
}
flag_valid_pin, _ := h.flagManager.GetFlag("flag_valid_pin")
if string(input) != "0" {
if !h.st.Back() {
pinInput := string(input)
// Validate that the PIN is a 4-digit number.
if pin.IsValidPIN(pinInput) {
@ -384,12 +384,6 @@ func (h *MenuHandlers) SaveOthersTemporaryPin(ctx context.Context, sym string, i
}
temporaryPin := string(input)
// Validate that the input is a 4-digit number.
if !pin.IsValidPIN(temporaryPin) {
return res, nil
}
// Retrieve the blocked number associated with this session
blockedNumber, err := store.ReadEntry(ctx, sessionId, storedb.DATA_BLOCKED_NUMBER)
if err != nil {
@ -422,7 +416,7 @@ func (h *MenuHandlers) CheckBlockedNumPinMisMatch(ctx context.Context, sym strin
if !ok {
return res, fmt.Errorf("missing session")
}
if string(input) == "0" {
if h.st.Back() {
res.FlagReset = append(res.FlagReset, flag_pin_mismatch)
return res, nil
}
@ -462,7 +456,7 @@ func (h *MenuHandlers) ConfirmPinChange(ctx context.Context, sym string, input [
}
flag_pin_mismatch, _ := h.flagManager.GetFlag("flag_pin_mismatch")
if string(input) == "0" {
if h.st.Back() {
res.FlagReset = append(res.FlagReset, flag_pin_mismatch)
return res, nil
}
@ -607,20 +601,16 @@ func (h *MenuHandlers) ValidateBlockedNumber(ctx context.Context, sym string, in
return res, fmt.Errorf("missing session")
}
if string(input) == "0" {
if h.st.Back() {
res.FlagReset = append(res.FlagReset, flag_unregistered_number)
return res, nil
}
blockedNumber := string(input)
formattedNumber, err := phone.FormatPhoneNumber(blockedNumber)
if err != nil {
_, err = store.ReadEntry(ctx, blockedNumber, storedb.DATA_PUBLIC_KEY)
if !phone.IsValidPhoneNumber(blockedNumber) {
res.FlagSet = append(res.FlagSet, flag_unregistered_number)
logg.ErrorCtxf(ctx, "Failed to format the phone number: %s", blockedNumber, "error", err)
return res, nil
}
_, err = store.ReadEntry(ctx, formattedNumber, storedb.DATA_PUBLIC_KEY)
if err != nil {
if db.IsNotFound(err) {
logg.InfoCtxf(ctx, "Invalid or unregistered number")
@ -631,7 +621,7 @@ func (h *MenuHandlers) ValidateBlockedNumber(ctx context.Context, sym string, in
return res, err
}
}
err = store.WriteEntry(ctx, sessionId, storedb.DATA_BLOCKED_NUMBER, []byte(formattedNumber))
err = store.WriteEntry(ctx, sessionId, storedb.DATA_BLOCKED_NUMBER, []byte(blockedNumber))
if err != nil {
return res, nil
}

View File

@ -21,7 +21,7 @@ var (
sessionID string
src = rand.NewSource(42)
g = rand.New(src)
secondarySessionId = "+254700000000"
secondarySessionId = "0700000000"
)
var groupTestFile = flag.String("test-file", "group_test.json", "The test file to use for running the group tests")

View File

@ -1,4 +1,4 @@
CATCH incorrect_pin flag_incorrect_pin 1
CATCH pin_entry flag_incorrect_pin 1
RELOAD retrieve_blocked_number
MAP retrieve_blocked_number
CATCH invalid_others_pin flag_valid_pin 0

View File

@ -1,4 +1,4 @@
CATCH no_admin_privilege flag_admin_privilege 0
CATCH no_admin_privilege flag_admin_privilege 0
LOAD reset_account_authorized 0
RELOAD reset_account_authorized
MOUT back 0

View File

@ -1,8 +1,7 @@
RELOAD reset_allow_update
RELOAD reset_incorrect
MOUT back 0
HALT
INCMP _ 0
RELOAD authorize_account
CATCH incorrect_pin flag_incorrect_pin 1
CATCH _ flag_allow_update 0
INCMP new_pin *

View File

@ -3,4 +3,3 @@ MOUT quit 9
HALT
INCMP _ 1
INCMP quit 9
INCMP . *

View File

@ -3,12 +3,12 @@ LOAD authorize_account 5
LOAD reset_allow_update 4
LOAD verify_new_pin 2
LOAD save_temporary_pin 1
LOAD reset_incorrect 0
LOAD reset_incorrect 0
MOUT change_pin 1
MOUT reset_pin 2
MOUT back 0
HALT
INCMP _ 0
INCMP old_pin 1
INCMP old_pin 1
INCMP enter_other_number 2
INCMP . *

View File

@ -3,4 +3,4 @@ MOUT quit 9
HALT
INCMP _ 1
INCMP quit 9
INCMP . *

View File

@ -3,4 +3,3 @@ MOUT quit 9
HALT
INCMP main 0
INCMP quit 9
INCMP . *