diff --git a/app/login/page.tsx b/app/login/page.tsx index a6e7fb4..075d844 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -18,7 +18,7 @@ function removeLocalData() { export default function Component() { const [errorMessage, setErrorMessage] = useState(null); - const [email, setEmail] = useState(""); + const [name, setEmail] = useState(""); const [password, setPassword] = useState(""); const router = useRouter(); const { t } = useTranslation(); // Use translation hook for localization @@ -31,7 +31,7 @@ export default function Component() { const response = await axios.post( `/api/v1/auth/login`, { - email, + name, password, } ); @@ -39,7 +39,7 @@ export default function Component() { if (response.status === 200) { // Save the token in local storage for future requests localStorage.setItem("authToken", response.data.token); - localStorage.setItem("email", email); + localStorage.setItem("name", name); // Redirect to the home page router.push("/"); } @@ -48,8 +48,8 @@ export default function Component() { setTimeout(() => { setErrorMessage(null); }, 2000); - // Set the focus to the email input field - document.getElementById("email")?.focus(); + // Set the focus to the name input field + document.getElementById("name")?.focus(); } }; @@ -85,13 +85,13 @@ export default function Component() { )}
- + setEmail(e.target.value)} onKeyDown={handleKeyDown} /> diff --git a/app/settings/page.tsx b/app/settings/page.tsx index 9b3750c..eac8b0c 100644 --- a/app/settings/page.tsx +++ b/app/settings/page.tsx @@ -17,13 +17,13 @@ export default function Component() { window.location.href = '/login'; // Redirect to the login page (where the authToken is cleared) } - // TODO: Make it more robust by fetching the email by API, not storing it in local storage + // TODO: Make it more robust by fetching the name by API, not storing it in local storage const getEmail = (): string => { if (typeof window !== 'undefined') { - const email = localStorage.getItem('email'); // Safe to use localStorage here - if (email) return email; + const name = localStorage.getItem('name'); // Safe to use localStorage here + if (name) return name; } - return 'Email not found'; + return 'name'; }; return ( diff --git a/lib/locales/de.json b/lib/locales/de.json index 275baf9..47f68ec 100644 --- a/lib/locales/de.json +++ b/lib/locales/de.json @@ -82,9 +82,9 @@ }, "login": { "title": "Anmeldung", - "description": "Geben Sie Ihre E-Mail-Adresse und Ihr Passwort ein, um sich bei Ihrem Konto anzumelden", - "email": "E-Mail", - "emailPlaceholder": "Ihre E-Mail-Adresse", + "description": "Geben Sie Ihre Name und Ihr Passwort ein, um sich bei Ihrem Konto anzumelden", + "name": "Name", + "emailPlaceholder": "Ihre Name", "password": "Passwort", "passwordPlaceholder": "Ihr Passwort", "loginButton": "Anmelden" diff --git a/lib/locales/en.json b/lib/locales/en.json index d90b954..412e52e 100644 --- a/lib/locales/en.json +++ b/lib/locales/en.json @@ -82,9 +82,9 @@ }, "login": { "title": "Login", - "description": "Enter your email and password to login to your account", - "email": "Email", - "emailPlaceholder": "Your email address", + "description": "Enter your name and password to login to your account", + "name": "Name", + "emailPlaceholder": "Your name", "password": "Password", "passwordPlaceholder": "Your password", "loginButton": "Login"