From 59eb4cf1b00e124da48d493518727b5642fb4636 Mon Sep 17 00:00:00 2001 From: Kamil Páral Date: Jun 16 2022 12:38:05 +0000 Subject: oob_response: avoid extra newlines in a copied token If you select the response token by double-clicking the line and copy-paste it from Firefox, you'll currently get: ``` \n\ncode=token\n\n ``` This is non-ideal, because while the consumer library (in my case, bodhi-client) can handle the initial extra newlines, perhaps not all consumers will. Additionaly, the first ending newline is used to automatically submit the pasted line (so you can't even verify it was pasted correctly, it's immediately sent), and the second ending newline is queued on standard input of the terminal and will be sent to the CLI app once it asks for any input. In my case that completely skipped the first interactive input of the app, because Enter is used to skip in there. That's very inconvenient. With this patch, double-clicking the line and copy-pasting it from Firefox will give you: ``` code=token ``` exactly as expected, no extra newlines, and you can confirm the input yourself. In Chromium, there is no change with this patch. Every time you get: ``` code=token\n ``` That has one more newline than I'd personally like, but at least it doesn't cause any unintended behavior in the calling app, because it's consumed by submitting the input line. Signed-off-by: Kamil Páral --- diff --git a/templates/openidc/oob_response.html b/templates/openidc/oob_response.html index fd75ebd..c941782 100644 --- a/templates/openidc/oob_response.html +++ b/templates/openidc/oob_response.html @@ -4,9 +4,7 @@

You are authenticated! Please copy and paste the following code in the application:

-
-
{{ response_info|urlencode }}
-
+
{{ response_info|urlencode }}

You can close this browser window afterwards.

diff --git a/themes/Fedora/templates/openidc/oob_response.html b/themes/Fedora/templates/openidc/oob_response.html index 5c1dadc..01ff366 100644 --- a/themes/Fedora/templates/openidc/oob_response.html +++ b/themes/Fedora/templates/openidc/oob_response.html @@ -4,9 +4,7 @@

You are authenticated! Please copy and paste the following code in the application:

-
-
{{ response_info|urlencode }}
-
+
{{ response_info|urlencode }}

You can close this browser window afterwards.