$user = new PanelUser($_POST['username']);
/* not being too informative with the login error in case of attackers */
- if (!$user->id)
- {
- $failmsg = "Incorrect login";
- }
- else if ($user->password_verify($_POST['password']))
+ if (isset($user->id) && $user->password_verify($_POST['password']))
{
$_SESSION['id'] = $user->id;
header('Location: ' . $redirect);
- $user->add_meta("last_login", date("Y-m-d m:i:s"));
+ $user->add_meta("last_login", date("Y-m-d H:i:s"));
+ Hook::run(HOOKTYPE_USER_LOGIN, $user);
+ die();
}
else
{
+ $fail = [
+ "login" => htmlspecialchars($_POST['username']),
+ "IP" => $_SERVER['REMOTE_ADDR']
+ ];
+ Hook::run(HOOKTYPE_USER_LOGIN_FAIL, $fail);
$failmsg = "Incorrect login";
}
<title>UnrealIRCd Panel</title>
<link rel="icon" type="image/x-icon" href="<?php echo BASE_URL; ?>img/favicon.ico">
<link href="<?php echo BASE_URL; ?>css/unrealircd-admin.css" rel="stylesheet">
-</head><div class="text-center">
-<a href="<?php echo BASE_URL; ?>plugins/sql_auth/login.php"><button type="button" style="margin:0; top:50%; position: absolute;" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#loginModaltitle">
- Login to continue
-</button></a>
-</div>
+</head>
<script>
$(document).ready(function(){
- $("#loginModal").modal('show');
+ $("#loginModal").modal({backdrop: 'static', keyboard: false}, 'show');
});
+
</script>
<body role="document">
<div class="container-fluid">
<form method="post" action="index.php?redirect=<?php echo $redirect; ?>">
- <div class="modal" id="loginModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="loginModal" aria-hidden="true">
+ <div class="modal" id="loginModal" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="loginModal" aria-hidden="false"></a>
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header" style="margin: 0 auto;">