Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Log-in auth UI button and invalid credentials message #953

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/cat/routes/static/core_static_folder/auth/auth.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ button {
background-color: #ccc;
color: white;
font-weight: bold;
cursor: pointer;
}

button:hover {
button.active {
background-color: #333;
}

Expand Down
31 changes: 25 additions & 6 deletions core/cat/routes/static/core_static_folder/auth/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@
<body>
<form action="/auth/redirect" method="POST">
<img id="logo" src="[[ url_for('core-static', path='/img/logo.svg') ]]">
<div class="error-message">
[[ error_message ]]
</div>
<div>
<input type="text" id="username" name="username" required autofocus placeholder="Username">
<input type="text" id="username" name="username" oninput="toggleButtonColor()" required autofocus placeholder="Username">
</div>
<div>
<input type="password" id="password" name="password" required placeholder="Password">
<input type="password" id="password" name="password" oninput="toggleButtonColor()" required placeholder="Password">
</div>
<div>
<input type="hidden" name="referer" value="[[ referer ]]">
</div>
<div>
<button type="submit">Login</button>
<button type="submit" id="submitLogin">Login</button>
</div>
{% if show_default_passwords %}
Default users included out of the box:
Expand All @@ -32,10 +35,26 @@
{% endif %}
<div>
</div>
<div class="error-message">
[[ error_message ]]
</div>
</form>


<script>
function toggleButtonColor() {
const button = document.getElementById('submitLogin');
const usernameValue = document.getElementById('username').value;
const passwordValue = document.getElementById('password').value;

if (usernameValue !== "" && passwordValue != "") {
button.disabled = false;
button.classList.add('active');
} else {
button.disabled = true;
button.classList.remove('active');

}
}
</script>
</body>


</html>
Loading