-
{t("select_device")}
- {showSpinner && (
-
-
-
- )}
+
+
+
+
-
- {page === 1 &&
}
- {page === 2 &&
}
- {page === 3 &&
}
- {page === 4 &&
}
- {page === 5 && (
-
-
-
- )}
-
- {page === 6 && (
-
- )}
-
-
- {/* fake Element to not break layout */}
- {page === 1 &&
}
- {page > 1 && (
-
- )}
- {page < 6 && (
-
- )}
- {page === 6 && (
-
- )}
-
-
+
);
}
diff --git a/app/routes/join.tsx b/app/routes/join.tsx
index 8613d588..2f40dd1f 100644
--- a/app/routes/join.tsx
+++ b/app/routes/join.tsx
@@ -13,6 +13,7 @@ import { createUser, getUserByEmail } from "~/models/user.server";
import { safeRedirect, validateEmail, validateName } from "~/utils";
import i18next from "app/i18next.server";
import ErrorMessage from "~/components/error-message";
+import { getProfileByUsername } from "~/models/profile.server";
export async function loader({ request }: LoaderFunctionArgs) {
const userId = await getUserId(request);
@@ -92,6 +93,21 @@ export async function action({ request }: ActionFunctionArgs) {
);
}
+ // check if profile exists by name
+ const existingUserByName = await getProfileByUsername(name);
+ if (existingUserByName) {
+ return data(
+ {
+ errors: {
+ name: "A user already exists with this name",
+ email: null,
+ password: null,
+ },
+ },
+ { status: 400 },
+ );
+ }
+
//* get current locale
const locale = await i18next.getLocale(request);
const language = locale === "de" ? "de_DE" : "en_US";
diff --git a/app/routes/login.tsx b/app/routes/login.tsx
index d9a5c2ac..685e67f0 100644
--- a/app/routes/login.tsx
+++ b/app/routes/login.tsx
@@ -7,6 +7,7 @@ import { data, redirect } from "@remix-run/node";
import { Form, Link, useActionData, useSearchParams } from "@remix-run/react";
import * as React from "react";
import ErrorMessage from "~/components/error-message";
+import { NavBar } from "~/components/nav-bar";
import { verifyLogin } from "~/models/user.server";
import { createUserSession, getUserId } from "~/session.server";
@@ -89,100 +90,103 @@ export default function LoginPage() {
}, [actionData]);
return (
-