fix: Update HTML Form for Login#45
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the login page’s HTML form markup/behavior, likely aiming to improve client-side validation and focus behavior.
Changes:
- Added
id,required, andautofocusattributes to login inputs and adjusted the form attributes. - Switched the submit control from
<input type="submit">to a<button>. styles/global.cssshows a full-file diff (appears mostly/entirely formatting or line-ending churn).
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| styles/global.css | Large diff affecting the global stylesheet; appears unrelated to login form behavior and may be mostly churn. |
| login.php | Updates login form fields (ids/required/autofocus), changes submit element, but leaves structural/JS issues. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <script type="text/javascript" language="JavaScript"> | ||
| <!-- | ||
| var focusControl = document.forms["login"].elements["userName"]; | ||
| if (focusControl.type != "hidden" && !focusControl.disabled) { | ||
| focusControl.focus(); | ||
| } | ||
| // --> | ||
| </script> |
There was a problem hiding this comment.
The focus script references document.forms["login"], but the form is now named/id'd loginForm (and the username field already has autofocus). As written, document.forms["login"] will be undefined and accessing .elements can throw a JS error. Update the selector to the correct form/id or remove this script and rely on autofocus.
| <script type="text/javascript" language="JavaScript"> | |
| <!-- | |
| var focusControl = document.forms["login"].elements["userName"]; | |
| if (focusControl.type != "hidden" && !focusControl.disabled) { | |
| focusControl.focus(); | |
| } | |
| // --> | |
| </script> |
| <form action="action_login.php" method="post" name="loginForm" id="loginForm"> | ||
| <div class="section"> Entrar al sistema</div> | ||
| <table style="margin: 15px 0pt 0pt;" border="0" cellpadding="0" | ||
| cellspacing="0"> | ||
| <tbody> |
There was a problem hiding this comment.
The login <form> is opened but never closed, and the surrounding table row/cell tags are also not properly closed. This produces invalid HTML and can cause inconsistent rendering/DOM structure (including the JS that relies on the form). Add the missing closing tags (at least </form> and the corresponding </td></tr> etc.) in the appropriate place before the outer table/div closes.
| </div> | ||
| </div> | ||
| <br> | ||
| <?php } $fields = " ".base64_decode( $_GET[ "tk" ] ); ?> |
There was a problem hiding this comment.
$fields is built from base64_decode($_GET["tk"]) without checking that tk exists. On newer PHP versions, passing null into base64_decode() can raise a TypeError, breaking the login page when visited without a tk parameter. Default tk to an empty string (or guard with isset) before decoding.
| <?php } $fields = " ".base64_decode( $_GET[ "tk" ] ); ?> | |
| <?php } $fields = " ".base64_decode( isset( $_GET[ "tk" ] ) ? $_GET[ "tk" ] : "" ); ?> |
| <table border="0" cellpadding="0" style="text-align: center;" | ||
| cellspacing="0" style="width:200px"> |
There was a problem hiding this comment.
This table tag has two style attributes (style="text-align: center;" and style="width:200px"), which is invalid HTML; the latter typically wins, dropping the earlier styles. Combine these into a single style attribute (or move to CSS).
| <table border="0" cellpadding="0" style="text-align: center;" | |
| cellspacing="0" style="width:200px"> | |
| <table border="0" cellpadding="0" cellspacing="0" style="text-align: center; width:200px"> |
| include_once "./includes/settings.php"; | ||
| include_once "./includes/db.php"; | ||
|
|
||
| $sselected = 1; $subtitle = $_i18n["login.submenu"]; $selected = $_GET[ "sm" ]; |
There was a problem hiding this comment.
$selected is read from $_GET["sm"] without an isset/default. This can trigger notices (and stricter setups may treat notices as errors). Use a default (e.g., null/0) when the query param isn't present and validate it before use.
| $sselected = 1; $subtitle = $_i18n["login.submenu"]; $selected = $_GET[ "sm" ]; | |
| $sselected = 1; $subtitle = $_i18n["login.submenu"]; $selected = ( isset( $_GET[ "sm" ] ) && ctype_digit( (string) $_GET[ "sm" ] ) ) ? (int) $_GET[ "sm" ] : null; |
| span.bar1 span { | ||
| background: #b2cffd; | ||
| float: left; | ||
| height: 5px; | ||
| // border-right:1px solid #9aa6b3; | ||
| } |
There was a problem hiding this comment.
This CSS file contains //-style comments (e.g., inside rule blocks). // is not valid CSS comment syntax and can lead to parsing issues in strict CSS parsers/tools. Replace these with /* ... */ comments or remove them.
| .bl3 {background:url(img/bl.gif) 0 100% no-repeat #FFD363; width:30em; text-align:center;font-weight:bolder;} | ||
| .bl3l {background:url(img/bl.gif) 0 100% no-repeat #FFD363; width:20em; text-align:center;font-weight:bolder;} | ||
| .bl2 {background:url(img/bl.gif) 0 100% no-repeat #FFD363; width:30em; text-align:center; padding:10px;font-weight:bolder;} | ||
| .bl {background:url(img/bl.gif) 0 100% no-repeat; width:20em; text-align:center} | ||
| .br {background:url(img/br.gif) 100% 100% no-repeat} |
There was a problem hiding this comment.
This PR rewrites the entire global.css file in the diff, but the sampled sections appear semantically unchanged. Full-file reformatting/line-ending churn makes review and future merges harder; if possible, limit the change to only the CSS that needs updating for the login form.
Automated fix by CoderOps.
Swarm: SwarmX3
Task: Update HTML Form for Login