From ffafbac05b1f58796f770142ea563021533c9858 Mon Sep 17 00:00:00 2001
From: Benoit Alessandroni <benoit@happy-dev.fr>
Date: Thu, 11 Jul 2019 12:06:19 +0200
Subject: [PATCH] Trying to force the login through oidc directly

---
 src/includes/entrepreneur/login.pug | 21 +++++++++++++--------
 src/includes/mentor/login.pug       | 18 ++++++++++--------
 src/index.pug                       | 11 +++++++++++
 3 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/src/includes/entrepreneur/login.pug b/src/includes/entrepreneur/login.pug
index 3ca1e327..70bb0b04 100644
--- a/src/includes/entrepreneur/login.pug
+++ b/src/includes/entrepreneur/login.pug
@@ -1,10 +1,15 @@
 h2 I am an entrepreneur
 
-form(method='POST' action='/login')
-    div.form-group
-        label(for='email') Email
-        input.form-control(type='text' id='email' placeholder='email' name='email')
-    div.form-group
-        label(for='password') Password
-        input.form-control(type='password' id='password' placeholder='password' name='password')
-    button.btn.btn-primary(type='submit') Log in 
\ No newline at end of file
+button(role='log in' onclick="document.querySelector('sib-auth').login();") Login as entrepreneur
+
+//- form(method='POST' action='/login')
+//-     div.form-group
+//-         label(for='email') Email
+//-         input.form-control(type='text' id='email' placeholder='email' name='email')
+//-     div.form-group
+//-         label(for='password') Password
+//-         input.form-control(type='password' id='password' placeholder='password' name='password')
+//-     button.btn.btn-primary(type='submit') Log in 
+
+sib-link(next='entrepreneur-new-account')
+    div Create an account
\ No newline at end of file
diff --git a/src/includes/mentor/login.pug b/src/includes/mentor/login.pug
index 5bef16a4..97c2ede6 100644
--- a/src/includes/mentor/login.pug
+++ b/src/includes/mentor/login.pug
@@ -1,13 +1,15 @@
 h2 I am a mentor
 
-form(method='POST' action='/login')
-    div.form-group
-        label(for='email') Email
-        input.form-control(type='text' id='email' placeholder='email' name='email')
-    div.form-group
-        label(for='password') Password
-        input.form-control(type='password' id='password' placeholder='password' name='password')
-    button.btn.btn-primary(type='submit') Log in 
+button(role='log in' onclick="document.querySelector('sib-auth').login();") Login as mentor
+
+//- form(method='POST' action='/login')
+//-     div.form-group
+//-         label(for='email') Email
+//-         input.form-control(type='text' id='email' placeholder='email' name='email')
+//-     div.form-group
+//-         label(for='password') Password
+//-         input.form-control(type='password' id='password' placeholder='password' name='password')
+//-     button.btn.btn-primary(type='submit') Log in 
 
 sib-link(next='mentor-new-account')
     div Create an account
\ No newline at end of file
diff --git a/src/index.pug b/src/index.pug
index 3ebd83f0..08db7c68 100644
--- a/src/index.pug
+++ b/src/index.pug
@@ -16,4 +16,15 @@ html
         #entrepreneur-new-account(hidden).no-sidebar
             include includes/entrepreneur/create.pug
         
+    sib-auth
+      sib-auth-provider(
+        class="sib-auth-provider"
+        data-authority=`${sdn}`
+        data-client_id=`${client_id}`,
+        data-id="coopstarter"
+        data-response_type='id_token token',
+        data-scope='openid profile email',
+        data-automaticSilentRenew='true',
+        data-loadUserInfo='true'
+      )
 
-- 
GitLab