From 03dfdd8cbb3d0fb36809f0c0d39092433109bb11 Mon Sep 17 00:00:00 2001
From: Bastien DUMONT <bdumont@grandlyon.com>
Date: Wed, 3 Aug 2022 16:29:10 +0200
Subject: [PATCH] fix: return of verifyUserIdentity

---
 src/index.js              | 7 ++-----
 src/verifyUserIdentity.js | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/index.js b/src/index.js
index e781bc8..20790ee 100644
--- a/src/index.js
+++ b/src/index.js
@@ -80,11 +80,8 @@ async function start(fields, cozyParameters) {
   log('info', 'User Logging...')
 
   if (await isFirstStart()) {
-    if (
-      !(await verifyUserIdentity(fields, baseUrl, apiAuthKey, loginUtilisateur))
-    ) {
-      throw errors.LOGIN_FAILED
-    }
+    await verifyUserIdentity(fields, baseUrl, apiAuthKey, loginUtilisateur)
+
     await createBoConsent()
     //TODO: remove because useless ? Done later in code
     // const startDate = await getDataStartDate(
diff --git a/src/verifyUserIdentity.js b/src/verifyUserIdentity.js
index e934c5d..2d46ced 100644
--- a/src/verifyUserIdentity.js
+++ b/src/verifyUserIdentity.js
@@ -9,6 +9,7 @@ const { getInseeCode } = require('./requests/insee')
  * @param {string} baseUrl
  * @param {string} apiAuthKey
  * @param {string} loginUtilisateur
+ * @returns {Promise<void>}
  */
 async function verifyUserIdentity(
   fields,
@@ -32,7 +33,6 @@ async function verifyUserIdentity(
     log('error', 'PointId does not match')
     throw errors.LOGIN_FAILED
   }
-  return true
 }
 
 module.exports = { verifyUserIdentity }
-- 
GitLab