Skip to content
Open
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
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
<form action="action_login.php" method="post" name="settings">
<table style="margin: 15px 0pt 0pt;" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<script src='jscripts/cpanel.js'></script>
<tr>
Comment on lines 29 to 32
<th align="right" nowrap="nowrap"><?=$_i18n[ "user" ]?> :&nbsp;&nbsp;&nbsp;&nbsp;</th>
<td><input name="userName" size="35" type="text" class="rounded"> <?php if( strpos( $fields, 'userName' ) ){?><br>
<span class="errormsg" id="errormsg_0"> <?=$_i18n[ "error.required" ]?>
</span><?php } ?></td>
</tr>
<form id='loginForm' action='action_login.php' method='post' name='settings'>
<tr>
Comment on lines 28 to 38
<td></td>
<td
Expand Down
43 changes: 36 additions & 7 deletions jscripts/cpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,42 @@ function uncheckItem(item) {


/* select a radio button */
function selectRadioButton(formId, groupId, value) {
var group = document.forms[formId][groupId];
for (var i=0; i<group.length; i++) {
if (group[i].value == value) {
group[i].checked=true;
return;
}
function validateLoginForm(form) {
const username = form.elements['username'].value.trim();
const password = form.elements['password'].value.trim();
Comment on lines +110 to +111
let valid = true;
if (!username) {
alert('Please enter your username.');
valid = false;
}
if (!password) {
alert('Please enter your password.');
valid = false;
}
return valid;
}
function addLoginFormListeners() {
const loginForm = document.querySelector('#loginForm');
if (loginForm) {
loginForm.addEventListener('submit', function(event) {
if (!validateLoginForm(this)) {
event.preventDefault();
}
});
}
const usernameField = loginForm.elements['username'];
usernameField.addEventListener('input', function() {
if (this.value.trim()) {
this.style.borderColor = '';
}
});
const passwordField = loginForm.elements['password'];
passwordField.addEventListener('input', function() {
Comment on lines +123 to +139
if (this.value.trim()) {
this.style.borderColor = '';
}
});
}
}
};
Comment on lines 145 to 146

Comment on lines +131 to 147
Expand Down