Skip to content

Commit

Permalink
translations
Browse files Browse the repository at this point in the history
  • Loading branch information
sinamics committed Aug 21, 2024
1 parent 93ba3a5 commit 621c37a
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 7 deletions.
7 changes: 7 additions & 0 deletions src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"emailPlaceholder": "mail@example.com",
"password": "Password",
"passwordPlaceholder": "Enter your password",
"confirmPassword": "Confirm Password",
"confirmPasswordPlaceholder": "Confirm your password",
"forgotPassword": "Forgot your password?",
"verify2FA": "Verify 2FA",
"enter2FAcode": "Enter 2FA Code",
Expand Down Expand Up @@ -175,6 +177,11 @@
"forgotPasswordMessage": "We will send you a reset link if the account exists",
"backToLogin": "Back to Login"
},
"forgotReset": {
"forgotPasswordTitle": "Reset Password",
"forgotPasswordMessage": "Please enter your new password",
"backToLogin": "Back to Login"
},
"mfaRecovery": {
"mfaRecoveryTitle": "2FA Recovery",
"mfaRecoveryMessage": "We will send you instructions on how to recover your account",
Expand Down
7 changes: 7 additions & 0 deletions src/locales/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"emailPlaceholder": "correo@ejemplo.com",
"password": "Contraseña",
"passwordPlaceholder": "Introduce tu contraseña",
"confirmPassword": "Confirmar Contraseña",
"confirmPasswordPlaceholder": "Confirme su contraseña",
"forgotPassword": "¿Olvidaste tu contraseña?",
"verify2FA": "Verificar 2FA",
"enter2FAcode": "Introduce el código 2FA",
Expand Down Expand Up @@ -175,6 +177,11 @@
"forgotPasswordMessage": "Te enviaremos un enlace de restablecimiento si la cuenta existe",
"backToLogin": "Volver al inicio de sesión"
},
"forgotReset": {
"forgotPasswordTitle": "Restablecer Contraseña",
"forgotPasswordMessage": "Por favor, ingrese su nueva contraseña",
"backToLogin": "Volver al Inicio de Sesión"
},
"mfaRecovery": {
"mfaRecoveryTitle": "Recuperación de 2FA",
"mfaRecoveryMessage": "Te enviaremos instrucciones sobre cómo recuperar tu cuenta",
Expand Down
7 changes: 7 additions & 0 deletions src/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"emailPlaceholder": "mail@exemple.com",
"password": "Mot de passe",
"passwordPlaceholder": "Entrez votre mot de passe",
"confirmPassword": "Confirmer le Mot de Passe",
"confirmPasswordPlaceholder": "Confirmez votre mot de passe",
"forgotPassword": "Mot de passe oublié ?",
"verify2FA": "Vérifier 2FA",
"enter2FAcode": "Entrez le code 2FA",
Expand Down Expand Up @@ -175,6 +177,11 @@
"forgotPasswordMessage": "Nous vous enverrons un lien de réinitialisation si le compte existe",
"backToLogin": "Retour à la connexion"
},
"forgotReset": {
"forgotPasswordTitle": "Réinitialiser le Mot de Passe",
"forgotPasswordMessage": "Veuillez entrer votre nouveau mot de passe",
"backToLogin": "Retour à la Connexion"
},
"mfaRecovery": {
"mfaRecoveryTitle": "Récupération 2FA",
"mfaRecoveryMessage": "Nous vous enverrons des instructions pour récupérer votre compte",
Expand Down
7 changes: 7 additions & 0 deletions src/locales/no/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"emailPlaceholder": "mail@eksempel.com",
"password": "Passord",
"passwordPlaceholder": "Skriv inn passordet ditt",
"confirmPassword": "Bekreft Passord",
"confirmPasswordPlaceholder": "Bekreft passordet ditt",
"forgotPassword": "Glemt passordet ditt?",
"verify2FA": "Bekreft 2FA",
"enter2FAcode": "Skriv inn 2FA-koden",
Expand Down Expand Up @@ -175,6 +177,11 @@
"forgotPasswordMessage": "Vi sender deg en tilbakestillingslenke hvis kontoen eksisterer",
"backToLogin": "Tilbake til innlogging"
},
"forgotReset": {
"forgotPasswordTitle": "Tilbakestill Passord",
"forgotPasswordMessage": "Vennligst skriv inn ditt nye passord",
"backToLogin": "Tilbake til Innlogging"
},
"mfaRecovery": {
"mfaRecoveryTitle": "Gjenoppretting av 2FA",
"mfaRecoveryMessage": "Vi vil sende deg instruksjoner om hvordan du gjenoppretter kontoen din",
Expand Down
7 changes: 7 additions & 0 deletions src/locales/pl/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"emailPlaceholder": "mail@przyklad.com",
"password": "Hasło",
"passwordPlaceholder": "Wpisz swoje hasło",
"confirmPassword": "Potwierdź Hasło",
"confirmPasswordPlaceholder": "Potwierdź swoje hasło",
"forgotPassword": "Zapomniałeś hasła?",
"verify2FA": "Zweryfikuj 2FA",
"enter2FAcode": "Wpisz kod 2FA",
Expand Down Expand Up @@ -175,6 +177,11 @@
"forgotPasswordMessage": "Wyślemy Ci link do resetowania, jeśli konto istnieje",
"backToLogin": "Powrót do logowania"
},
"forgotReset": {
"forgotPasswordTitle": "Zresetuj Hasło",
"forgotPasswordMessage": "Proszę wprowadzić nowe hasło",
"backToLogin": "Powrót do Logowania"
},
"mfaRecovery": {
"mfaRecoveryTitle": "Odzyskiwanie 2FA",
"mfaRecoveryMessage": "Wyślemy Ci instrukcje, jak odzyskać swoje konto",
Expand Down
7 changes: 7 additions & 0 deletions src/locales/zh-tw/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"emailPlaceholder": "mail@example.com",
"password": "密碼",
"passwordPlaceholder": "輸入您的密碼",
"confirmPassword": "確認密碼",
"confirmPasswordPlaceholder": "確認您的密碼",
"forgotPassword": "忘記密碼?",
"verify2FA": "驗證 2FA",
"enter2FAcode": "輸入2FA代碼",
Expand Down Expand Up @@ -175,6 +177,11 @@
"forgotPasswordMessage": "如果帳戶存在,我們會向您發送重置鏈接",
"backToLogin": "返回登錄"
},
"forgotReset": {
"forgotPasswordTitle": "重設密碼",
"forgotPasswordMessage": "請輸入您的新密碼",
"backToLogin": "返回登入"
},
"mfaRecovery": {
"mfaRecoveryTitle": "2FA恢復",
"mfaRecoveryMessage": "我們將向您發送有關如何恢復您的帳戶的說明",
Expand Down
7 changes: 7 additions & 0 deletions src/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"emailPlaceholder": "mail@example.com",
"password": "密码",
"passwordPlaceholder": "输入您的密码",
"confirmPassword": "确认密码",
"confirmPasswordPlaceholder": "确认您的密码",
"forgotPassword": "忘记密码?",
"verify2FA": "验证 2FA",
"enter2FAcode": "输入2FA代码",
Expand Down Expand Up @@ -175,6 +177,11 @@
"forgotPasswordMessage": "如果账户存在,我们将向您发送重置链接",
"backToLogin": "返回登录"
},
"forgotReset": {
"forgotPasswordTitle": "重置密码",
"forgotPasswordMessage": "请输入您的新密码",
"backToLogin": "返回登录"
},
"mfaRecovery": {
"mfaRecoveryTitle": "2FA恢复",
"mfaRecoveryMessage": "我们将向您发送恢复帐户的说明",
Expand Down
52 changes: 45 additions & 7 deletions src/pages/auth/forgotPassword/reset/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ import Head from "next/head";
import { globalSiteTitle } from "~/utils/global";
import FormInput from "~/components/auth/formInput";
import FormSubmitButtons from "~/components/auth/formSubmitButton";
import { useTranslations } from "next-intl";
import { Session } from "next-auth";
import { GetServerSideProps, GetServerSidePropsContext } from "next";
import { getSession } from "next-auth/react";

const ForgotPassword = () => {
const t = useTranslations();
const router = useRouter();
const { token } = router.query;
const [state, setState] = useState({ password: "", newPassword: "" });
Expand Down Expand Up @@ -85,17 +90,21 @@ const ForgotPassword = () => {
<div className="z-10 flex h-screen w-screen items-center justify-center">
<div className="w-100 mx-auto rounded-2xl border border-1 border-primary p-12">
<div className="mb-4">
<h3 className="text-2xl font-semibold">Reset Password</h3>
<p className="text-gray-500">Please enter your new password</p>
<h3 className="text-2xl font-semibold">
{t("authPages.forgotReset.forgotPasswordTitle")}
</h3>
<p className="text-gray-500">
{t("authPages.forgotReset.forgotPasswordMessage")}
</p>
</div>
<form className="space-y-5" onSubmit={submitHandler}>
<FormInput
label="Password"
label={t("authPages.form.password")}
name="password"
type="password"
value={state.password}
onChange={handleChange}
placeholder="Enter your password"
placeholder={t("authPages.form.passwordPlaceholder")}
icon={
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -112,12 +121,12 @@ const ForgotPassword = () => {
}
/>
<FormInput
label="Password"
label={t("authPages.form.confirmPassword")}
name="newPassword"
type="password"
value={state.newPassword}
onChange={handleChange}
placeholder="Confirm your new password"
placeholder={t("authPages.form.confirmPasswordPlaceholder")}
icon={
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -134,7 +143,7 @@ const ForgotPassword = () => {
}
/>
<div className="pt-5">
<FormSubmitButtons loading={isLoading} title="Reset Password" />
<FormSubmitButtons loading={isLoading} title={t("commonButtons.submit")} />
</div>
</form>
<div className="pt-5 text-center text-xs text-gray-400">
Expand All @@ -146,4 +155,33 @@ const ForgotPassword = () => {
);
};

interface Props {
auth?: Session["user"];
}
export const getServerSideProps: GetServerSideProps<Props> = async (
context: GetServerSidePropsContext,
) => {
const session = await getSession(context);
if (!session || !("user" in session) || !session.user) {
return {
props: {
messages: (await import(`~/locales/${context.locale}/common.json`)).default,
},
};
}

if (session.user) {
return {
redirect: {
destination: "/network",
permanent: false,
},
};
}

return {
props: { auth: session.user },
};
};

export default ForgotPassword;

0 comments on commit 621c37a

Please sign in to comment.