forked from urdt/ussd
validate PIN using the set AccountPIN
This commit is contained in:
parent
a508f06583
commit
460e951584
17
cmd/main.go
17
cmd/main.go
@ -362,8 +362,21 @@ func (fsd *fsData) checkIdentifier(ctx context.Context, sym string, input []byte
|
|||||||
func (fsd *fsData) unLock(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (fsd *fsData) unLock(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
res := resource.Result{}
|
res := resource.Result{}
|
||||||
pin := string(input)
|
pin := string(input)
|
||||||
if len(input) > 0 {
|
fp := fsd.path + "_data"
|
||||||
if pin == "0000" {
|
|
||||||
|
jsonData, err := os.ReadFile(fp)
|
||||||
|
if err != nil {
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var accountData map[string]string
|
||||||
|
err = json.Unmarshal(jsonData, &accountData)
|
||||||
|
if err != nil {
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(input) > 1 {
|
||||||
|
if pin != accountData["AccountPIN"] {
|
||||||
res.FlagSet = append(res.FlagSet, USERFLAG_INCORRECTPIN)
|
res.FlagSet = append(res.FlagSet, USERFLAG_INCORRECTPIN)
|
||||||
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
|
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
|
||||||
return res, nil
|
return res, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user