From b1553ec7bf3efbf6d22a561c487a07e7bc778eeb Mon Sep 17 00:00:00 2001
From: phil <phil.dev@philome.mooo.com>
Date: Fri, 10 Jan 2025 23:40:24 +0100
Subject: [PATCH] Add hint to providers

---
 src/oidc_test/settings.py         |  1 +
 src/oidc_test/templates/base.html | 35 +----------------
 src/oidc_test/templates/home.html | 64 ++++++++++++++++++++++++++++---
 3 files changed, 60 insertions(+), 40 deletions(-)

diff --git a/src/oidc_test/settings.py b/src/oidc_test/settings.py
index a271caf..ba2d6a0 100644
--- a/src/oidc_test/settings.py
+++ b/src/oidc_test/settings.py
@@ -19,6 +19,7 @@ class OIDCProvider(BaseModel):
     url: str
     client_id: str
     client_secret: str = ""
+    hint: str = "Use your own credentials"
 
     @computed_field
     @property
diff --git a/src/oidc_test/templates/base.html b/src/oidc_test/templates/base.html
index abfbb40..1b66ac2 100644
--- a/src/oidc_test/templates/base.html
+++ b/src/oidc_test/templates/base.html
@@ -52,40 +52,7 @@
       .user-info a.logout:hover {
         background-color: orange;
       }
-      .login-box {
-        text-align: center;
-      }
-      .login-box p {
-        margin: 0;
-      }
-      .login-toolbox {
-        max-width: 18em;
-        margin: 0.5em auto;
-        display: flex;
-        flex-direction: column;
-        justify-content: center;
-        padding: 0.8em;
-        background-color: floralwhite;
-        gap: 0.5em;
-      }
-      .login-toolbox a {
-        background-color: lightblue;
-        font-weight: bold;
-        border-radius: 8px;
-        padding: 6px;
-        text-decoration: none;
-        text-align: center;
-        color: black;
-        flex: 1 1 auto;
-      }
-      .login-toolbox .error {
-        color: darkred;
-        padding: 3px 6px;
-        text-align: center;
-        font-weight: bold;
-        flex: 1 1 auto;
-      }
-      .debug-auth {
+     .debug-auth {
         font-size: 90%;
         background-color: #d8bebc75;
         padding: 6px;
diff --git a/src/oidc_test/templates/home.html b/src/oidc_test/templates/home.html
index 1574647..c3d9cdb 100644
--- a/src/oidc_test/templates/home.html
+++ b/src/oidc_test/templates/home.html
@@ -1,20 +1,72 @@
 {% extends "base.html" %}
 {% block content %}
+<style>
+ .login-box {
+   text-align: center;
+   background-color: floralwhite;
+   margin: 0 auto;
+   width: fit-content;
+   border: 1px solid grey;
+ }
+ .login-box p {
+   margin: 0;
+ }
+ .login-box .description {
+   font-style: italic;
+ }
+ .providers {
+   margin: 0.5em auto;
+   justify-content: center;
+   padding: 0.8em;
+ }
+ .providers .provider {
+   height: 2em;
+ }
+ .providers .provider a {
+   background-color: lightblue;
+   border-radius: 8px;
+   padding: 6px;
+   text-align: center;
+   color: black;
+   text-decoration: none;
+   font-weight: bold;
+ }
+ .providers .provider .hint {
+   font-size: 80%;
+   max-width: 12em;
+ }
+ .providers .provider .provider-link {
+   text-align: center;
+ }
+ .providers .error {
+   color: darkred;
+   padding: 3px 6px;
+   text-align: center;
+   font-weight: bold;
+   flex: 1 1 auto;
+ }
+</style>
   <p class="center">
     Test the authentication and authorization of FastAPI web based applications
     with OpenID Connect and OAuth2 with different providers.
   </p>
   {% if not user %} 
   <div class="login-box">
-    <div class="login-toolbox">
-      <p>Log in with one of these authentication providers:</p>
+    <p class="description">Log in with one of these authentication providers:</p>
+    <table class="providers">
       {% for provider in settings.oidc.providers %}
-        <a href="login/{{ provider.id }}">{{ provider.name }}</a>
+      <tr class="provider">
+        <td class="provider-link">
+          <a href="login/{{ provider.id }}">{{ provider.name }}</a>
+        </td>
+        <td class="hint">{{ provider.hint }}</div>
+        </td>
+      </tr>
       {% else %}
-        <span class="error">There is no authentication provider defined.
-        Hint: check the settings.yaml file.</span>
+        <div class="error">There is no authentication provider defined.
+        Hint: check the settings.yaml file.</div>
       {% endfor %}
-    </div>
+    </table>
   </div>
   {% endif %}
   {% if user %}