<link rel="stylesheet" href="./media/install.css" type="text/css" >
<title><?php ptrans ('SYP wizard')?></title>
<script type="text/javascript">
+ var sypStrings = {
+ emptyPasswordError: "<?php ptrans('Password cannot be empty')?>"
+ };
+
function init () {
if (document.getElementById('db_host')) {
document.getElementById('db_host').focus();
document.getElementById('admin_pass').select();
}
}
+
+ function checkpwd () {
+ var pass = document.getElementById('admin_pass').value;
+ if (!pass) {
+ document.getElementById('empty_pass_error').innerHTML = sypStrings.emptyPasswordError;
+ document.getElementById('empty_pass_error').style.display = "block";
+ document.getElementById('admin_pass').focus();
+ return false;
+ }
+ return true;
+ }
</script>
</head>
<body onload="init()">
if ($users_table_exists) {
par_success (trans ('Found user table.'));
} else {
- if (isset($_POST ["admin_pass"])) {
+ $empty_pass = (isset ($_POST ["admin_pass"]) && (strlen ($_POST ["admin_pass"]) == 0));
+ if ($_POST ["admin_pass"]) {
try {
$connection->create_users_table (true);
} catch (Exception $e) {
par_success (trans ('Admin password initialized.'));
} else {
- print ('<form class="center" method="post" action="">
+ print ('<form class="center" method="post" action="" onsubmit="return checkpwd()">
<label for="admin_pass">' . trans ("choose admin password") . '</label>
- <input id="admin_pass" name="admin_pass" type="password">
- <input type="submit">
- </form>');
+ <input id="admin_pass" name="admin_pass" type="password">');
+ if ($empty_pass) {
+ print ('<p class="error" id="empty_pass_error">' . trans('Password cannot be empty') . '</p>');
+ } else {
+ print ('<p class="error" style="display: none" id="empty_pass_error"></p>');
+ }
+ print ('<br><input type="submit"></form>');
leave ();
}
}