changeset 5625:e86a1018cdb3

mod_http_oauth2: Present errors in HTML <dialog> Nice semantic things that don't require JavaScript
author Kim Alvefur <zash@zash.se>
date Mon, 31 Jul 2023 02:07:24 +0200
parents 6109496a7ccc
children a44af1b646f5
files mod_http_oauth2/html/consent.html mod_http_oauth2/html/device.html mod_http_oauth2/html/login.html mod_http_oauth2/html/style.css
diffstat 4 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_oauth2/html/consent.html	Mon Jul 31 02:05:49 2023 +0200
+++ b/mod_http_oauth2/html/consent.html	Mon Jul 31 02:07:24 2023 +0200
@@ -7,10 +7,11 @@
 <link rel="stylesheet" href="style.css" />
 </head>
 <body>
-	{state.error&<div class="error">
+{state.error&
+	<dialog open="" class="error">
 		<p>{state.error}</p>
-	</div>}
-
+		<form method="dialog"><button>dismiss</button></form>
+	</dialog>}
 	<header>
 	<h1>{site_name}</h1>
 	</header>
--- a/mod_http_oauth2/html/device.html	Mon Jul 31 02:05:49 2023 +0200
+++ b/mod_http_oauth2/html/device.html	Mon Jul 31 02:07:24 2023 +0200
@@ -7,15 +7,17 @@
 <link rel="stylesheet" href="style.css" />
 </head>
 <body>
+{error&
+	<dialog open="" class="error">
+		<p>{error.text}</p>
+		<form method="dialog"><button>dismiss</button></form>
+	</dialog>}
 	<header>
 	<h1>{site_name}</h1>
 	</header>
 	<main>
 	<fieldset>
 	<legend>Device Authorization</legend>
-	{error&<div class="error">
-		<p>{error.text}</p>
-	</div>}
 {client&
 	<p>Authorization completed. You can go back to
 	<em>{client.client_name}</em>.</p>}
--- a/mod_http_oauth2/html/login.html	Mon Jul 31 02:05:49 2023 +0200
+++ b/mod_http_oauth2/html/login.html	Mon Jul 31 02:07:24 2023 +0200
@@ -7,6 +7,11 @@
 <link rel="stylesheet" href="style.css" />
 </head>
 <body>
+{state.error&
+	<dialog open="" class="error">
+		<p>{state.error}</p>
+		<form method="dialog"><button>dismiss</button></form>
+	</dialog>}
 	<header>
 	<h1>{site_name}</h1>
 	</header>
@@ -14,9 +19,6 @@
 	<fieldset>
 	<legend>Sign in</legend>
 	<p>Sign in to your account to continue.</p>
-	{state.error&<div class="error">
-		<p>{state.error}</p>
-	</div>}
 	<form method="post">
 		<input type="text" name="username" placeholder="Username" aria-label="Username" required {extra.username_hint~autofocus}{extra.username_hint& value="{extra.username_hint?}"} /><br/>
 		<input type="password" name="password" placeholder="Password" aria-label="Password" autocomplete="current-password" required {extra.username_hint&autofocus} /><br />
--- a/mod_http_oauth2/html/style.css	Mon Jul 31 02:05:49 2023 +0200
+++ b/mod_http_oauth2/html/style.css	Mon Jul 31 02:07:24 2023 +0200
@@ -21,7 +21,7 @@
 
 .error
 {
-	margin: 0.75em;
+	margin: 0.75em auto;
 	background-color: #f8d7da;
 	color: #842029;
 	border: solid 1px #f5c2c7;