From f574f13e9086b1f4ac8c622ff6153753a69c23ef Mon Sep 17 00:00:00 2001
From: Julian Rother <julianr@fsmpi.rwth-aachen.de>
Date: Mon, 5 Oct 2020 11:39:32 +0200
Subject: [PATCH] mfa ui enhancements

---
 uffd/mfa/templates/auth.html      | 5 +++--
 uffd/mfa/templates/setup.html     | 4 ++--
 uffd/session/templates/login.html | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/uffd/mfa/templates/auth.html b/uffd/mfa/templates/auth.html
index 033b98fc..2bacaf22 100644
--- a/uffd/mfa/templates/auth.html
+++ b/uffd/mfa/templates/auth.html
@@ -30,10 +30,10 @@
 		<div class="text-center text-muted d-none webauthn-group mb-3">- or -</div>
 		{% endif %}
 		<div class="form-group col-12 mb-2">
-			<input type="text" class="form-control" id="mfa-code" name="code" required="required" tabindex="1" placeholder="Code from your authenticator app or recovery code">
+			<input type="text" class="form-control" id="mfa-code" name="code" required="required" placeholder="Code from your authenticator app or recovery code" autocomplete="off" autofocus>
 		</div>
 		<div class="form-group col-12">
-			<button type="submit" class="btn btn-primary btn-block" tabindex="2">Verify</button>
+			<button type="submit" class="btn btn-primary btn-block">Verify</button>
 		</div>
 	</div>
 </div>
@@ -105,6 +105,7 @@ function begin_webauthn() {
 $('#webauthn-btn').on('click', begin_webauthn);
 if (typeof(PublicKeyCredential) != "undefined") {
 	$('.webauthn-group').removeClass('d-none');
+	begin_webauthn();
 } else {
 	$('#webauthn-unsupported').removeClass('d-none');
 }
diff --git a/uffd/mfa/templates/setup.html b/uffd/mfa/templates/setup.html
index 6ffeac9b..681aa257 100644
--- a/uffd/mfa/templates/setup.html
+++ b/uffd/mfa/templates/setup.html
@@ -80,7 +80,7 @@ You need to setup at least one authentication method to enable two-factor authen
 			<div class="row m-0">
 				<label class="sr-only" for="totp-name">Name</label>
 				<input type="text" name="name" class="form-control mb-2 col-12 col-lg-auto mr-2" style="width: 15em;" id="totp-name" placeholder="Name" required {{ 'disabled' if mfa_init }}>
-				<button type="submit" id="totp-submit" class="btn btn-primary mb-2 col" {{ 'disabled' if mfa_init }}>Setup new authenticator</button>
+				<button type="submit" id="totp-submit" class="btn btn-primary mb-2 col" {{ 'disabled' if mfa_init }}>Setup new app</button>
 			</div>
 		</form>
 
@@ -154,7 +154,7 @@ You need to setup at least one authentication method to enable two-factor authen
 				{% endfor %}
 				{% if not webauthn_methods %}
 				<tr class="table-secondary">
-					<td colspan=3 class="text-center">No devices registered yet</td>
+					<td colspan=3 class="text-center">No U2F/FIDO2 devices registered yet</td>
 				</tr>
 				{% endif %}
 			</tbody>
diff --git a/uffd/session/templates/login.html b/uffd/session/templates/login.html
index 9dfd5ae6..03323948 100644
--- a/uffd/session/templates/login.html
+++ b/uffd/session/templates/login.html
@@ -12,7 +12,7 @@
 		</div>
 		<div class="form-group col-12">
 			<label for="user-loginname">Login Name</label>
-			<input type="text" class="form-control" id="user-loginname" name="loginname" required="required" tabindex = "1">
+			<input type="text" class="form-control" id="user-loginname" name="loginname" required="required" tabindex = "1" autofocus>
 		</div>
 		<div class="form-group col-12">
 			<label for="user-password1">Password</label>
-- 
GitLab