X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/6930484cee8ca01014e0194df0ad8001e340ae5a..6b08fcb99e66665e7e4f345702915d7192fcd27b:/login/index.php?ds=sidebyside diff --git a/login/index.php b/login/index.php index 4f6ecb2..bea6f0a 100644 --- a/login/index.php +++ b/login/index.php @@ -1,41 +1,71 @@ - id) - { - $failmsg = "Incorrect login"; - } - else if ($user->password_verify($_POST['password'])) + $hash_needs_updating = false; + if (isset($user->id) && $user->password_verify($_POST['password'], $hash_needs_updating)) { + /* SUCCESSFUL LOGIN */ + if ($hash_needs_updating) + { + /* Set password again so it is freshly hashed */ + $hash = PanelUser::password_hash($_POST['password']); + $ar = ["update_pass_conf"=>$hash]; + $user->update_core_info($ar); + unset($ar); + unset($hash); + } + panel_start_session($user); $_SESSION['id'] = $user->id; + $user->add_meta("last_login", date("Y-m-d H:i:s")); + Hook::run(HOOKTYPE_USER_LOGIN, $user); + + /* Middle of install? Override redirect: */ + if (!isset($config['unrealircd']) || empty($config['unrealircd']['host'])) + $redirect = get_config("base_url")."settings/install2.php"; header('Location: ' . $redirect); - $user->add_meta("last_login", date("Y-m-d m:i:s")); + die(); } else { + /* LOGIN FAILED */ + $fail = [ + "login" => htmlspecialchars($_POST['username']), + "IP" => $_SERVER['REMOTE_ADDR'] + ]; + Hook::run(HOOKTYPE_USER_LOGIN_FAIL, $fail); $failmsg = "Incorrect login"; } @@ -46,6 +76,8 @@ if (!empty($_POST)) ?>
+css/unrealircd-admin.css" rel="stylesheet"> + @@ -61,59 +93,76 @@ if (!empty($_POST)) - +img/favicon.ico">