mirror of
git://f0xx.org/ac/ac-deploy
synced 2026-08-12 18:12:19 +03:00
Lab: remember-me, Grafana proxy fix, builder cache dirs, branded QR alerts.
Grafana auth restore + nginx proxy_cookie_path; alert-notifier branded QR; prepare-be-builder-dirs shared ccache/gradle; bump ac-scripts for Docker DLC maintenance. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,6 +14,17 @@ require_once dirname(__DIR__, 4) . '/platform/shared_session.php';
|
||||
|
||||
platform_start_session('ac_crash_sess', '/app/androidcast_project');
|
||||
|
||||
$composedSrc = dirname(__DIR__, 2) . '/src';
|
||||
if (is_file($composedSrc . '/AuthRemember.php')) {
|
||||
require_once $composedSrc . '/Database.php';
|
||||
require_once $composedSrc . '/Rbac.php';
|
||||
require_once $composedSrc . '/Auth.php';
|
||||
require_once $composedSrc . '/AuthRemember.php';
|
||||
require_once $composedSrc . '/AuthEmailSchema.php';
|
||||
require_once $composedSrc . '/AuthFactors.php';
|
||||
AuthRemember::tryRestore();
|
||||
}
|
||||
|
||||
$user = $_SESSION['user'] ?? null;
|
||||
|
||||
if (empty($user['id'])) {
|
||||
|
||||
@@ -165,10 +165,13 @@ if ($route === '/logout') {
|
||||
|
||||
if ($route === '/login' && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
Auth::captureRedirectFromRequest();
|
||||
AuthRemember::stashPendingFromRequest();
|
||||
$user = trim($_POST['username'] ?? '');
|
||||
$pass = $_POST['password'] ?? '';
|
||||
$result = Auth::login($user, $pass);
|
||||
if ($result === true) {
|
||||
$uid = (int) (Auth::user()['id'] ?? 0);
|
||||
AuthRemember::applyPending($uid);
|
||||
header('Location: ' . Auth::postLoginRedirect($base . '/'));
|
||||
exit;
|
||||
}
|
||||
@@ -191,6 +194,10 @@ if ($route === '/login' && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
if ($route === '/login') {
|
||||
Auth::captureRedirectFromRequest();
|
||||
if (Auth::user()) {
|
||||
header('Location: ' . Auth::postLoginRedirect($base . '/'));
|
||||
exit;
|
||||
}
|
||||
if (Auth::pending2faUserId() > 0) {
|
||||
header('Location: ' . Auth::authUrl('/two-factor'));
|
||||
exit;
|
||||
@@ -253,6 +260,8 @@ if ($route === '/two-factor' && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
$code = trim($_POST['code'] ?? '');
|
||||
if (Auth::completeTotpLogin($code)) {
|
||||
$uid = (int) (Auth::user()['id'] ?? 0);
|
||||
AuthRemember::applyPending($uid);
|
||||
header('Location: ' . Auth::postLoginRedirect($base . '/'));
|
||||
exit;
|
||||
}
|
||||
@@ -290,6 +299,8 @@ if (
|
||||
$status = AuthApproval::pollStatus($rawToken);
|
||||
if ($status === 'approved') {
|
||||
if (Auth::completeTotpLoginByApproval($rawToken)) {
|
||||
$uid = (int) (Auth::user()['id'] ?? 0);
|
||||
AuthRemember::applyPending($uid);
|
||||
echo json_encode([
|
||||
'status' => 'approved',
|
||||
'redirect' => Auth::postLoginRedirect($base . '/'),
|
||||
|
||||
Reference in New Issue
Block a user