From d1c10d781dcc8a8c08c3b1a8a48c949c7fc7c5eb Mon Sep 17 00:00:00 2001
From: Nathan Woodburn <github@nathan.woodburn.au>
Date: Thu, 27 Mar 2025 16:09:10 +1100
Subject: [PATCH] feat: Add custom instructions to login

---
 .env.example         | 2 ++
 server.py            | 4 +++-
 templates/index.html | 5 +++--
 templates/login.html | 5 ++++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/.env.example b/.env.example
index f99a776..a760bb5 100644
--- a/.env.example
+++ b/.env.example
@@ -4,6 +4,8 @@ SECRET_KEY=your_secret_key_here
 # Yubico API credentials (get from https://upgrade.yubico.com/getapikey/)
 YUBICO_CLIENT_ID=your_client_id
 YUBICO_SECRET_KEY=your_secret_key
+# OPTIONAL: YubiKey instructions for users (eg. "The yubikey attached to my keys")
+# YUBIKEY_INSTRUCTIONS=
 
 # Your YubiKey ID (first 12 characters of any OTP generated by your YubiKey)
 YUBIKEY_ID=ccccccxxxxxx
diff --git a/server.py b/server.py
index d7a1224..4590018 100644
--- a/server.py
+++ b/server.py
@@ -129,7 +129,9 @@ def login():
             except Exception as e:
                 error = f"Authentication error: {str(e)}"
     
-    return render_template("login.html", error=error)
+    custom_instructions = os.getenv("YUBIKEY_INSTRUCTIONS")
+
+    return render_template("login.html", error=error, custom_instructions=custom_instructions)
 
 @app.route("/logout")
 def logout():
diff --git a/templates/index.html b/templates/index.html
index 69fdc6c..a26e111 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -4,7 +4,7 @@
 <head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Nathan.Woodburn/</title>
+    <title>Emergency Access</title>
     <link rel="icon" href="/assets/img/favicon.png" type="image/png">
     <link rel="stylesheet" href="/assets/css/index.css">
 </head>
@@ -12,7 +12,8 @@
 <body>
     <div class="spacer"></div>
     <div class="centre">
-        <h1>Nathan.Woodburn/</h1>
+        <h1>Retrieve Emergency Information</h1>
+        <p>Access emergency information by logging in with your YubiKey.</p>
         {% if authenticated %}
             <p><a href="/emergency">Access Emergency Information</a></p>
             <p><a href="/logout">Logout</a></p>
diff --git a/templates/login.html b/templates/login.html
index 5df189c..9a4bc3f 100644
--- a/templates/login.html
+++ b/templates/login.html
@@ -41,7 +41,10 @@
     <div class="spacer"></div>
     <div class="centre">
         <h1>YubiKey Authentication</h1>
-        <p>Please insert your YubiKey and press it to authenticate.</p>
+        <p>Make sure the input field is selected and press your YubiKey to authenticate.</p>
+        {% if custom_instructions %}
+            <p>{{ custom_instructions }}</p>
+        {% endif %}
         
         {% if error %}
             <div class="error">{{ error }}</div>