Remove ugly spinner pages from auth flow
- Replace loading spinners and styling with minimal HTML pages - Auth flow now happens almost instantly without visible intermediary screens - Reduced bundle size for login/logout endpoints (0.59kB and 0.58kB) - Maintains seamless user experience while preserving Auth.js integration - Users stay on current page context during auth transitions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,25 +3,19 @@ import type { RequestHandler } from './$types';
|
|||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const GET: RequestHandler = async ({ url }) => {
|
||||||
const callbackUrl = url.searchParams.get('callbackUrl') || '/';
|
const callbackUrl = url.searchParams.get('callbackUrl') || '/';
|
||||||
|
|
||||||
// Create an auto-submitting form that POSTs to Auth.js signin
|
// Create a minimal page that immediately triggers auth in the same window
|
||||||
const html = `
|
const html = `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Redirecting to login...</title>
|
<title>Login</title>
|
||||||
<style>
|
|
||||||
body { font-family: system-ui; text-align: center; padding: 2rem; }
|
|
||||||
.spinner { border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 20px auto; }
|
|
||||||
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>Redirecting to login...</h2>
|
|
||||||
<div class="spinner"></div>
|
|
||||||
<form id="signin-form" method="POST" action="/auth/signin/authentik">
|
<form id="signin-form" method="POST" action="/auth/signin/authentik">
|
||||||
<input type="hidden" name="callbackUrl" value="${callbackUrl}" />
|
<input type="hidden" name="callbackUrl" value="${callbackUrl}" />
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
|
// Immediately submit the form to trigger auth flow
|
||||||
document.getElementById('signin-form').submit();
|
document.getElementById('signin-form').submit();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@@ -3,25 +3,19 @@ import type { RequestHandler } from './$types';
|
|||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const GET: RequestHandler = async ({ url }) => {
|
||||||
const callbackUrl = url.searchParams.get('callbackUrl') || '/';
|
const callbackUrl = url.searchParams.get('callbackUrl') || '/';
|
||||||
|
|
||||||
// Create an auto-submitting form that POSTs to Auth.js signout
|
// Create a minimal page that immediately triggers logout in the same window
|
||||||
const html = `
|
const html = `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Signing out...</title>
|
<title>Logout</title>
|
||||||
<style>
|
|
||||||
body { font-family: system-ui; text-align: center; padding: 2rem; }
|
|
||||||
.spinner { border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 20px auto; }
|
|
||||||
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>Signing out...</h2>
|
|
||||||
<div class="spinner"></div>
|
|
||||||
<form id="signout-form" method="POST" action="/auth/signout">
|
<form id="signout-form" method="POST" action="/auth/signout">
|
||||||
<input type="hidden" name="callbackUrl" value="${callbackUrl}" />
|
<input type="hidden" name="callbackUrl" value="${callbackUrl}" />
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
|
// Immediately submit the form to trigger logout flow
|
||||||
document.getElementById('signout-form').submit();
|
document.getElementById('signout-form').submit();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
Reference in New Issue
Block a user