diff --git a/.gitignore b/.gitignore index 16e654d..d9f7441 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.pdf ensap-payroll-cli ensap +ensap-cli /dist diff --git a/CHANGELOG.md b/CHANGELOG.md index 167e265..96d1aa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 2022-01-03 - Remi Ferrand - v0.2.1 + +* Modification liée au changement d'authentification sur le site ensap (voir #1) + ## 2021-09-13 - Remi Ferrand - v0.2.0 * Ajout de la sous commande `version` diff --git a/README.md b/README.md index a0d6f80..ddcbf5b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # ENSAP CLI +[![Go Report Card](https://goreportcard.com/badge/github.com/riton/ensap-cli)](https://goreportcard.com/report/github.com/riton/ensap-cli) + **Attention**: Cet outil est encore en développement. L'outil `ensap` n'étant accessible que depuis très peu de temps, les commandes présentées ci-dessous peuvent évoluer. ## Description diff --git a/api/v1/authentication.go b/api/v1/authentication.go index 7bfb32c..abacbb7 100644 --- a/api/v1/authentication.go +++ b/api/v1/authentication.go @@ -66,6 +66,8 @@ func (c *ensapV1APIClient) Login() error { endpoint := c.buildFullEndpoint(api.AuthentificationEndpoint, false) + log.Debugf("logging in using endpoint %s", endpoint) + req, err := http.NewRequestWithContext(c.ctx, http.MethodPost, endpoint, strings.NewReader(formData.Encode())) if err != nil { return errors.Wrap(err, "creating request object") @@ -73,6 +75,11 @@ func (c *ensapV1APIClient) Login() error { c.setRequestUserAgent(req) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + req.Header.Set("Accept", "application/json") + + // if c.cfg.Debug { + // debugDumpHTTPRequest("Login", req, true) + // } resp, err := c.httpClient.Do(req) if err != nil {