aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/app/.server/api/client.ts9
-rw-r--r--frontend/app/.server/api/schema.d.ts2
-rw-r--r--frontend/app/.server/auth.ts9
-rw-r--r--frontend/app/routes/login.tsx11
4 files changed, 3 insertions, 28 deletions
diff --git a/frontend/app/.server/api/client.ts b/frontend/app/.server/api/client.ts
index edcffc1..fef1508 100644
--- a/frontend/app/.server/api/client.ts
+++ b/frontend/app/.server/api/client.ts
@@ -8,18 +8,11 @@ const apiClient = createClient<paths>({
: "http://api-server/phperkaigi/2025/code-battle/api/",
});
-export async function apiPostLogin(
- username: string,
- password: string,
- registrationToken: string | null,
-) {
+export async function apiPostLogin(username: string, password: string) {
const { data, error } = await apiClient.POST("/login", {
body: {
username,
password,
- ...(registrationToken !== null
- ? { registration_token: registrationToken }
- : {}),
},
});
if (error) throw new Error(error.message);
diff --git a/frontend/app/.server/api/schema.d.ts b/frontend/app/.server/api/schema.d.ts
index 7fd612e..1afed69 100644
--- a/frontend/app/.server/api/schema.d.ts
+++ b/frontend/app/.server/api/schema.d.ts
@@ -321,8 +321,6 @@ export interface operations {
username: string;
/** @example password123 */
password: string;
- /** @example xxxxxxxxxxxxxxxx */
- registration_token?: string;
};
};
};
diff --git a/frontend/app/.server/auth.ts b/frontend/app/.server/auth.ts
index 4df0924..ac8afe8 100644
--- a/frontend/app/.server/auth.ts
+++ b/frontend/app/.server/auth.ts
@@ -14,14 +14,7 @@ authenticator.use(
new FormStrategy(async ({ form }) => {
const username = String(form.get("username"));
const password = String(form.get("password"));
- const registrationToken = String(form.get("registration_token"));
- return (
- await apiPostLogin(
- username,
- password,
- registrationToken === "" ? null : registrationToken,
- )
- ).token;
+ return (await apiPostLogin(username, password)).token;
}),
"default",
);
diff --git a/frontend/app/routes/login.tsx b/frontend/app/routes/login.tsx
index 223a3f5..5ca6217 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, json, useActionData, useLocation } from "@remix-run/react";
+import { Form, json, useActionData } from "@remix-run/react";
import { ensureUserNotLoggedIn, login } from "../.server/auth";
import BorderedContainer from "../components/BorderedContainer";
import InputText from "../components/InputText";
@@ -58,10 +58,6 @@ 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");
-
const loginErrors = useActionData<typeof action>();
return (
@@ -113,11 +109,6 @@ export default function Login() {
</p>
)}
</div>
- <input
- type="hidden"
- name="registration_token"
- value={registrationToken ?? ""}
- />
<div className="flex justify-center">
<SubmitButton type="submit">ログイン</SubmitButton>
</div>