1
0
mirror of git://f0xx.org/ac/ac-be-auth synced 2026-07-29 06:37:40 +03:00
Files
ac-be-auth/views/two_factor_approve.php
2026-06-28 22:55:51 +02:00

74 lines
2.6 KiB
PHP

<?php
$bp = Auth::basePath();
$auth = Auth::authUrl();
$user = Auth::user();
$rawToken = trim($_GET['token'] ?? $_POST['token'] ?? '');
?>
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Approve sign-in — <?= h(cfg('app_name')) ?></title>
<script>
(function () {
var t = localStorage.getItem('crash_console_theme');
if (t === 'light' || t === 'dark') document.documentElement.setAttribute('data-theme', t);
})();
</script>
<link rel="icon" type="image/x-icon" href="<?= h($bp) ?>/assets/favicon.ico">
<link rel="apple-touch-icon" href="<?= h($bp) ?>/assets/apple-touch-icon.ico">
<link rel="stylesheet" href="<?= h($bp) ?>/assets/css/app.css">
</head>
<body class="login-page">
<div class="login-card" style="text-align:center;">
<h1 style="font-size:1.5rem;margin-bottom:0.5rem;">
<?php if (!empty($approveResult)): ?>
<?= $approveResult === 'ok' ? '✅' : '⚠️' ?>
<?php else: ?>
🔐
<?php endif; ?>
</h1>
<?php if (!empty($approveResult)): ?>
<?php if ($approveResult === 'ok'): ?>
<p style="font-size:1.1rem;font-weight:600;" data-i18n="twofa.approve.success">
Sign-in approved.
</p>
<p class="muted">Your other device should now be logged in automatically.</p>
<?php else: ?>
<p class="alert">This approval link has expired or is invalid.</p>
<?php endif; ?>
<p style="margin-top:1.5rem;">
<a href="<?= h($auth) ?>/" class="button">Back to hub</a>
</p>
<?php elseif ($approvalInfo): ?>
<p style="font-size:1.1rem;font-weight:600;">Approve sign-in on another device?</p>
<p class="muted">
Tap <b>Approve</b> to log in the browser that showed you this QR code.<br>
This link expires in a few minutes.
</p>
<form method="post" action="<?= h($auth) ?>/two-factor/approve" style="margin-top:1.5rem;">
<input type="hidden" name="token" value="<?= h($rawToken) ?>">
<button type="submit" style="width:100%;font-size:1.1rem;">Approve</button>
</form>
<p style="margin-top:1rem;">
<a href="<?= h($auth) ?>/" class="muted" style="font-size:0.9rem;">Cancel</a>
</p>
<?php else: ?>
<p class="alert">This approval link has expired or has already been used.</p>
<p style="margin-top:1rem;">
<a href="<?= h($auth) ?>/" class="button">Back to hub</a>
</p>
<?php endif; ?>
</div>
<?php platform_render_footer(); ?>
</body>
</html>