Add session validation checks before executing vehicle commands
Some checks failed
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Failing after 27s
Some checks failed
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Failing after 27s
This commit is contained in:
12
client.go
12
client.go
@ -127,6 +127,12 @@ func (c *Client) SelectVehicle(vin string) (*VehicleData, error) {
|
||||
}
|
||||
vinCheck(vin)
|
||||
|
||||
// Validate session before executing the request
|
||||
if !c.validateSession() {
|
||||
c.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
|
||||
return nil, errors.New(APP_ERRORS["SESSION_EXPIRED"])
|
||||
}
|
||||
|
||||
params := map[string]string{
|
||||
"vin": vin,
|
||||
"_": timestamp()}
|
||||
@ -319,6 +325,12 @@ func (c *Client) SubmitAuthCode(code string, permanent bool) error {
|
||||
// getContactMethods retrieves the available contact methods for two-factor authentication (2FA).
|
||||
// {"success":true,"dataName":"dataMap","data":{"userName":"a**x@savin.nyc","email":"t***a@savin.nyc"}}
|
||||
func (c *Client) getContactMethods() error {
|
||||
// Validate session before executing the request
|
||||
if !c.validateSession() {
|
||||
c.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
|
||||
return errors.New(APP_ERRORS["SESSION_EXPIRED"])
|
||||
}
|
||||
|
||||
params := map[string]string{}
|
||||
reqUrl := MOBILE_API_VERSION + apiURLs["API_2FA_CONTACT"]
|
||||
resp, err := c.execute(POST, reqUrl, params, false)
|
||||
|
Reference in New Issue
Block a user