From af36c59851399194bcbb77a3093d46c2757cb7b4 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Fri, 9 Aug 2024 23:30:10 +0900
Subject: feat: support authentication via fortee

---
 frontend/app/routes/login.tsx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'frontend/app/routes/login.tsx')

diff --git a/frontend/app/routes/login.tsx b/frontend/app/routes/login.tsx
index dc87d47..d6414f7 100644
--- a/frontend/app/routes/login.tsx
+++ b/frontend/app/routes/login.tsx
@@ -3,7 +3,7 @@ import type {
 	LoaderFunctionArgs,
 	MetaFunction,
 } from "@remix-run/node";
-import { Form } from "@remix-run/react";
+import { Form, useLocation } from "@remix-run/react";
 import { ensureUserNotLoggedIn, login } from "../.server/auth";
 
 export const meta: MetaFunction = () => [
@@ -20,6 +20,10 @@ export async function action({ request }: ActionFunctionArgs) {
 }
 
 export default function Login() {
+	const location = useLocation();
+	const searchParams = new URLSearchParams(location.search);
+	const registrationToken = searchParams.get("registration_token");
+
 	return (
 		<div className="min-h-screen bg-gray-100 flex items-center justify-center">
 			<Form
@@ -58,6 +62,11 @@ export default function Login() {
 						className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500"
 					/>
 				</div>
+				<input
+					type="hidden"
+					name="registration_token"
+					value={registrationToken ?? ""}
+				/>
 				<button
 					type="submit"
 					className="w-full bg-blue-500 text-white py-2 rounded hover:bg-blue-600 transition duration-300"
-- 
cgit v1.2.3-70-g09d2

