refactor: rename email back to username

This commit is contained in:
Stavros
2025-01-26 18:29:30 +02:00
parent 708006decf
commit 989ea8f229
12 changed files with 58 additions and 58 deletions

View File

@@ -32,7 +32,7 @@ export const LoginPage = () => {
}
const schema = z.object({
email: z.string().email(),
username: z.string(),
password: z.string(),
});
@@ -41,7 +41,7 @@ export const LoginPage = () => {
const form = useForm({
mode: "uncontrolled",
initialValues: {
email: "",
username: "",
password: "",
},
validate: zodResolver(schema),
@@ -54,7 +54,7 @@ export const LoginPage = () => {
onError: () => {
notifications.show({
title: "Failed to login",
message: "Check your email and password",
message: "Check your username and password",
color: "red",
});
},
@@ -154,7 +154,7 @@ export const LoginPage = () => {
)}
</Grid>
<Divider
label="Or continue with email"
label="Or continue with password"
labelPosition="center"
my="lg"
/>
@@ -162,12 +162,12 @@ export const LoginPage = () => {
)}
<form onSubmit={form.onSubmit(handleSubmit)}>
<TextInput
label="Email"
label="Username"
placeholder="user@example.com"
required
disabled={loginMutation.isLoading}
key={form.key("email")}
{...form.getInputProps("email")}
key={form.key("username")}
{...form.getInputProps("username")}
/>
<PasswordInput
label="Password"

View File

@@ -8,7 +8,7 @@ import { Layout } from "../components/layouts/layout";
import { capitalize } from "../utils/utils";
export const LogoutPage = () => {
const { isLoggedIn, email, oauth, provider } = useUserContext();
const { isLoggedIn, username, oauth, provider } = useUserContext();
if (!isLoggedIn) {
return <Navigate to="/login" />;
@@ -44,7 +44,7 @@ export const LogoutPage = () => {
Logout
</Text>
<Text>
You are currently logged in as <Code>{email}</Code>
You are currently logged in as <Code>{username}</Code>
{oauth && ` using ${capitalize(provider)}`}. Click the button below to
log out.
</Text>

View File

@@ -6,7 +6,7 @@ import { Navigate } from "react-router";
export const UnauthorizedPage = () => {
const queryString = window.location.search;
const params = new URLSearchParams(queryString);
const email = params.get("email");
const username = params.get("email");
const { isLoggedIn } = useUserContext();
@@ -14,7 +14,7 @@ export const UnauthorizedPage = () => {
return <Navigate to="/" />;
}
if (email === "null") {
if (username === "null") {
return <Navigate to="/" />;
}
@@ -25,7 +25,7 @@ export const UnauthorizedPage = () => {
Unauthorized
</Text>
<Text>
The user with email address <Code>{email}</Code> is not authorized to
The user with username <Code>{username}</Code> is not authorized to
login.
</Text>
<Button

View File

@@ -2,7 +2,7 @@ import { z } from "zod";
export const userContextSchema = z.object({
isLoggedIn: z.boolean(),
email: z.string(),
username: z.string(),
oauth: z.boolean(),
provider: z.string(),
configuredProviders: z.array(z.string()),