Skip to content

Commit

Permalink
Fix TOTP input field not being shown when enabled (#2783)
Browse files Browse the repository at this point in the history
  • Loading branch information
DL6ER authored Oct 30, 2023
2 parents b73a1da + 4d7f8ed commit e669b99
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scripts/pi-hole/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,16 @@ $(function () {
// Check if we need to login at all
$.ajax({
url: "/api/auth",
}).done(function (data) {
if (data.session.valid === true) redirect();
if (data.session.totp === true) $("#totp_input").removeClass("hidden");
});
})
.done(function (data) {
// If we are already logged in, redirect to dashboard
if (data.session.valid === true) redirect();
})
.fail(function (xhr) {
const session = xhr.responseJSON.session;
// If TOPT is enabled, show the input field
if (session.totp === true) $("#totp_input").removeClass("hidden");
});

// Get information about HTTPS port and DNS status
$.ajax({
Expand Down

0 comments on commit e669b99

Please sign in to comment.