From 42a76c9efdce7653c4c8f066556bf48650b1311f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Ferrand?= Date: Wed, 15 Sep 2021 13:22:40 +0200 Subject: [PATCH 1/3] Add goreportcard --- README.md | 2 ++ 1 file changed, 2 insertions(+) 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 From c2822413b190e3b6b03c58f5639428a45ba0abda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Ferrand?= Date: Mon, 3 Jan 2022 13:55:00 +0100 Subject: [PATCH 2/3] Adapt authentication to new auth style * See #1 --- .gitignore | 1 + api/v1/authentication.go | 7 +++++++ 2 files changed, 8 insertions(+) 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/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 { From 3a8af38fbfab8969657dda600f98b6dc37c86f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Ferrand?= Date: Mon, 3 Jan 2022 14:02:48 +0100 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) 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`