Compare commits

...

9 Commits

90 changed files with 50 additions and 7 deletions

View File

@ -43,7 +43,7 @@ func (p *asyncRequestParser) GetInput(r any) ([]byte, error) {
func main() { func main() {
config.LoadConfig() config.LoadConfig()
var override config.Override var override config.Override
var sessionId string var sessionId string
var size uint var size uint

View File

@ -32,7 +32,7 @@ func (k KeyInfo) String() string {
func ToKeyInfo(k []byte, sessionId string) (KeyInfo, error) { func ToKeyInfo(k []byte, sessionId string) (KeyInfo, error) {
o := KeyInfo{} o := KeyInfo{}
o.SessionId = sessionId o.SessionId = sessionId
o.Typ = uint8(k[0]) o.Typ = uint8(k[0])
k = k[1:] k = k[1:]
@ -53,7 +53,7 @@ func ToKeyInfo(k []byte, sessionId string) (KeyInfo, error) {
k = k[2:] k = k[2:]
} }
return o, nil return o, nil
} }

View File

@ -253,6 +253,35 @@ func (h *MenuHandlers) ResetValidPin(ctx context.Context, sym string, input []by
return res, nil return res, nil
} }
// CheckBlockedStatus resets the account blocked flag if the PIN attempts have been reset by an admin.
func (h *MenuHandlers) CheckBlockedStatus(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
store := h.userdataStore
flag_account_blocked, _ := h.flagManager.GetFlag("flag_account_blocked")
sessionId, ok := ctx.Value("SessionId").(string)
if !ok {
return res, fmt.Errorf("missing session")
}
currentWrongPinAttempts, err := store.ReadEntry(ctx, sessionId, storedb.DATA_INCORRECT_PIN_ATTEMPTS)
if err != nil {
if !db.IsNotFound(err) {
return res, nil
}
}
pinAttemptsValue, _ := strconv.ParseUint(string(currentWrongPinAttempts), 0, 64)
if pinAttemptsValue == 0 {
res.FlagReset = append(res.FlagReset, flag_account_blocked)
return res, nil
}
return res, nil
}
// ResetIncorrectPin resets the incorrect pin flag after a new PIN attempt. // ResetIncorrectPin resets the incorrect pin flag after a new PIN attempt.
func (h *MenuHandlers) ResetIncorrectPin(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (h *MenuHandlers) ResetIncorrectPin(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result var res resource.Result
@ -467,7 +496,13 @@ func (h *MenuHandlers) ResetOthersPin(ctx context.Context, sym string, input []b
err = store.WriteEntry(ctx, string(blockedPhonenumber), storedb.DATA_ACCOUNT_PIN, []byte(hashedTmporaryPin)) err = store.WriteEntry(ctx, string(blockedPhonenumber), storedb.DATA_ACCOUNT_PIN, []byte(hashedTmporaryPin))
if err != nil { if err != nil {
return res, nil return res, err
}
err = store.WriteEntry(ctx, string(blockedPhonenumber), storedb.DATA_INCORRECT_PIN_ATTEMPTS, []byte(string("0")))
if err != nil {
logg.ErrorCtxf(ctx, "failed to reset incorrect PIN attempts", "key", storedb.DATA_INCORRECT_PIN_ATTEMPTS, "error", err)
return res, err
} }
return res, nil return res, nil

View File

@ -62,6 +62,7 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountService)
} }
//appHandlers = appHandlers.WithPersister(ls.Pe) //appHandlers = appHandlers.WithPersister(ls.Pe)
appHandlers.SetPersister(ls.Pe) appHandlers.SetPersister(ls.Pe)
ls.DbRs.AddLocalFunc("check_blocked_status", appHandlers.CheckBlockedStatus)
ls.DbRs.AddLocalFunc("set_language", appHandlers.SetLanguage) ls.DbRs.AddLocalFunc("set_language", appHandlers.SetLanguage)
ls.DbRs.AddLocalFunc("create_account", appHandlers.CreateAccount) ls.DbRs.AddLocalFunc("create_account", appHandlers.CreateAccount)
ls.DbRs.AddLocalFunc("save_temporary_pin", appHandlers.SaveTemporaryPin) ls.DbRs.AddLocalFunc("save_temporary_pin", appHandlers.SaveTemporaryPin)

View File

@ -4,8 +4,8 @@ TXTS = $(wildcard ./*.txt.orig)
VISE_PATH := ../../go-vise VISE_PATH := ../../go-vise
# Rule to build .bin files from .vis files # Rule to build .bin files from .vis files
%.vis: %.vis: buildasm
go run $(VISE_PATH)/dev/asm/main.go -f pp.csv $(basename $@).vis > $(basename $@).bin ./vise-asm -f pp.csv $(basename $@).vis > $(basename $@).bin
@echo "Built $(basename $@).bin from $(basename $@).vis" @echo "Built $(basename $@).bin from $(basename $@).vis"
# Rule to copy .orig files to .txt # Rule to copy .orig files to .txt
@ -19,5 +19,10 @@ all: $(INPUTS) $(TXTS)
clean: clean:
rm -vf *.bin rm -vf *.bin
rm -vf ./vise-asm
buildasm:
go build -v -o ./vise-asm $(VISE_PATH)/dev/asm/main.go
.PHONY: clean .PHONY: clean

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,11 @@
LOAD check_blocked_status 1
RELOAD check_blocked_status
CATCH blocked_account flag_account_blocked 1 CATCH blocked_account flag_account_blocked 1
CATCH select_language flag_language_set 0 CATCH select_language flag_language_set 0
CATCH terms flag_account_created 0 CATCH terms flag_account_created 0
LOAD check_account_status 0 LOAD check_account_status 0
RELOAD check_account_status RELOAD check_account_status
CATCH api_failure flag_api_call_error 1 CATCH api_failure flag_api_call_error 1
CATCH account_pending flag_account_pending 1 CATCH account_pending flag_account_pending 1
CATCH create_pin flag_pin_set 0 CATCH create_pin flag_pin_set 0
CATCH main flag_account_success 1 CATCH main flag_account_success 1

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.