diff --git a/public/locales/de/translation.json b/public/locales/de/translation.json index 16873c1..a331234 100644 --- a/public/locales/de/translation.json +++ b/public/locales/de/translation.json @@ -36,6 +36,7 @@ "emailPlaceholderNew": "Geben Sie Ihre neue E-Mail ein", "password": "Passwort", "passwordPlaceholder": "Geben Sie Ihr Passwort ein", + "passwordPlaceholderNew": "Geben Sie Ihr neues Passwort ein", "noDataFound": "Keine Einträge gefunden", "calendarMaxFutureBookingDays": "Max. Tage im Voraus", "calendarMinEarliestBookingTime": "Min. früheste Buchungszeit", @@ -144,6 +145,7 @@ "signUpLink": "Jetzt registrieren", "login": { "button": "Anmelden", + "forgotPassword": "Passwort vergessen?", "dontHaveAccount": "Sie haben noch kein Konto?", "stateAccountPendingDeletion": { "title": "Anstehende Kontolöschung", @@ -171,12 +173,22 @@ "pendingEmailVerification": { "title": "E-Mail-Verifizierung ausstehend", "description": "Bitte überprüfen Sie Ihr E-Mail-Postfach und klicken Sie auf den Link in der E-Mail, um Ihre E-Mail-Adresse zu verifizieren." + }, + "request": { + "400": { + "title": "Registrierung fehlgeschlagen", + "description": "Bitte überprüfen Sie Ihre Eingaben und versuchen Sie es erneut." + } } }, - "request": { - "400": { - "title": "Registrierung fehlgeschlagen", - "description": "Bitte überprüfen Sie Ihre Eingaben und versuchen Sie es erneut." + "forgotPassword": { + "title": "Problem beim Anmelden?", + "info": "Geben Sie Ihre E-Mail-Adresse ein, und wir senden Ihnen einen Link zum Zurücksetzen Ihres Passworts.", + "button": "Passwort zurücksetzen", + "backToLogin": "Zurück zur Anmeldung", + "resetLinkSent": { + "title": "Link zum Zurücksetzen gesendet", + "description": "Wir haben Ihnen eine E-Mail mit einem Link zum Zurücksetzen Ihres Passworts geschickt. Bitte prüfen Sie Ihren E-Mail-Posteingang" } } }, @@ -395,9 +407,8 @@ "requesting": { "title": "E-Mail-Verifizierung ausstehend" }, - "Erfolg": { - "title": "E-Mail-Überprüfung erfolgreich", - "button": "Jetzt anmelden" + "success": { + "title": "E-Mail-Überprüfung erfolgreich" } }, { @@ -411,6 +422,18 @@ "success": { "title": "E-Mail-Änderung erfolgreich" } + }, + { + "init": { + "title": "Passwort zurücksetzen", + "subTitle": "Geben Sie Ihr neues Passwort ein" + }, + "requesting": { + "title": "Passwort wird zurückgesetzt" + }, + "success": { + "title": "Passwort erfolgreich zurückgesetzt" + } } ] }, diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 020568b..8e5d1c8 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -36,6 +36,7 @@ "emailPlaceholderNew": "Enter your new email", "password": "Password", "passwordPlaceholder": "Enter your password", + "passwordPlaceholderNew": "Enter your new password", "noDataFound": "No data found", "calendarMaxFutureBookingDays": "Max. future booking days", "calendarMinEarliestBookingTime": "Min. earliest booking time", @@ -144,6 +145,7 @@ "signUpLink": "Sign up now", "login": { "button": "Login", + "forgotPassword": "Forgot password?", "dontHaveAccount": "Don't have an account?", "stateAccountPendingDeletion": { "title": "Pending account deletion", @@ -178,6 +180,16 @@ "description": "Please check your inputs and try again." } } + }, + "forgotPassword": { + "title": "Problem when logging in?", + "info": "Enter your email address and we will send you a link to reset your password.", + "button": "Send reset link", + "backToLogin": "Back to login", + "resetLinkSent": { + "title": "Reset link sent", + "description": "We have sent you an email with a link to reset your password. Please check your email inbox." + } } }, "services": { @@ -414,6 +426,18 @@ "success": { "title": "Email change successful" } + }, + { + "init": { + "title": "Password reset", + "subTitle": "Enter your new password" + }, + "requesting": { + "title": "Resetting password" + }, + "success": { + "title": "Password reset successful" + } } ] }, diff --git a/src/Components/AppRoutes/index.js b/src/Components/AppRoutes/index.js index 804634d..5e4bc75 100644 --- a/src/Components/AppRoutes/index.js +++ b/src/Components/AppRoutes/index.js @@ -41,6 +41,15 @@ export function AuthenticationRoutes() { } /> + + + + } + /> + } diff --git a/src/Components/MyFormInputs/index.js b/src/Components/MyFormInputs/index.js index 98c4e2a..12cd186 100644 --- a/src/Components/MyFormInputs/index.js +++ b/src/Components/MyFormInputs/index.js @@ -45,6 +45,7 @@ export function MyPasswordFormInput({ label, inputPlaceholder, formItemRules, + newPassword, }) { const { t } = useTranslation(); @@ -63,7 +64,11 @@ export function MyPasswordFormInput({ minLength: Constants.GLOBALS.MIN_PASSWORD_LENGTH, } )} - inputPlaceholder={inputPlaceholder || t("common.passwordPlaceholder")} + inputPlaceholder={ + inputPlaceholder || newPassword + ? t("common.passwordPlaceholderNew") + : t("common.passwordPlaceholder") + } inputType="password" formItemRules={formItemRules} /> diff --git a/src/Pages/Authentication/index.js b/src/Pages/Authentication/index.js index 45e7926..f250b34 100644 --- a/src/Pages/Authentication/index.js +++ b/src/Pages/Authentication/index.js @@ -1,6 +1,7 @@ import { Button, Checkbox, + Divider, Flex, Form, Modal, @@ -32,6 +33,7 @@ import ReCAPTCHA from "react-google-recaptcha"; export const AuthenticationMethod = { LOGIN: 1, SIGNUP: 2, + FORGOT_PASSWORD: 3, }; export default function Authentication({ method }) { @@ -61,14 +63,38 @@ export default function Authentication({ method }) { {method === AuthenticationMethod.LOGIN ? ( - ) : ( + ) : method === AuthenticationMethod.SIGNUP ? ( + ) : ( + )} ); } +export function MyRecaptcha({ recaptchaRef, recaptchaValueRef }) { + const { t } = useTranslation(); + + return ( + + (recaptchaValueRef.current = value)} + /> + + ); +} + function RememberMeCheckbox() { const { t } = useTranslation(); @@ -242,23 +268,22 @@ function Login({ notificationApi }) { > - + + + + - - (recaptchaValueRef.current = value)} - /> - + @@ -456,20 +481,7 @@ function SignUp({ notificationApi }) { - - (recaptchaValueRef.current = value)} - /> - + @@ -510,3 +522,98 @@ function PendingEmailVerification() { /> ); } + +const FORGOT_PASSWORD_STEP = { + ENTER_EMAIL: 1, + RESET_LINK_SENT: 2, +}; + +function ForgotPassword({ notificationApi }) { + const { t } = useTranslation(); + const [form] = Form.useForm(); + const navigate = useNavigate(); + + const [step, setStep] = useState(SignUpStep.SIGN_UP); + const [isRequesting, setIsRequesting] = useState(false); + const recaptchaValueRef = useRef(null); + + if (step === FORGOT_PASSWORD_STEP.RESET_LINK_SENT) { + return ( + + ); + } + + return ( +
+ + {t("authentication.forgotPassword.title")} + + + + {t("authentication.forgotPassword.info")} + + + + + + + + + + + + + ); +} diff --git a/src/Pages/Verification/index.js b/src/Pages/Verification/index.js index 1f2a063..c0a0d94 100644 --- a/src/Pages/Verification/index.js +++ b/src/Pages/Verification/index.js @@ -102,6 +102,52 @@ export default function Verification() { extra: , }, }, + { + init: { + title: t("verification.content.2.init.title"), + subTitle: t("verification.content.2.init.subTitle"), + extra: ( +
+ + + + + ), + }, + requesting: { + title: t("verification.content.2.requesting.title"), + extra: , + }, + success: { + title: t("verification.content.2.success.title"), + extra: , + }, + }, ]; const parsedState = isNaN(state) ? 0 : parseInt(state); diff --git a/src/utils.js b/src/utils.js index aa22dc6..a410690 100644 --- a/src/utils.js +++ b/src/utils.js @@ -46,6 +46,7 @@ export const Constants = { AUTHENTICATION: { LOGIN: "/login", SIGN_UP: "/signup", + FORGOT_PASSWORD: "/forgot-password", }, VERIFY: "/verify", OVERVIEW: "/",