feat: added description and logout flow

This commit is contained in:
Kunal Garg
2025-04-19 13:45:22 +05:30
parent f27ede6b2c
commit 3062059ed5
7 changed files with 19 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
"use client";
import { formbricksLogout } from "@/app/lib/formbricks";
import { getFormattedErrorMessage } from "@/lib/utils/helper";
import { forgotPasswordAction } from "@/modules/auth/forgot-password/actions";
import { Button } from "@/modules/ui/components/button";
@@ -22,6 +23,7 @@ import { Label } from "@/modules/ui/components/label";
import { zodResolver } from "@hookform/resolvers/zod";
import { useTranslate } from "@tolgee/react";
import { ChevronDownIcon } from "lucide-react";
import { signOut } from "next-auth/react";
import { useState } from "react";
import { SubmitHandler, useForm } from "react-hook-form";
import toast from "react-hot-toast";
@@ -69,6 +71,8 @@ export const EditProfileDetailsForm = ({ user }: { user: TUser }) => {
toast.error(errorMessage);
} else {
toast.success(t("auth.forgot-password.email-sent.heading"));
await signOut({ callbackUrl: "/auth/login" });
await formbricksLogout();
}
setIsResettingPassword(false);
@@ -97,7 +101,6 @@ export const EditProfileDetailsForm = ({ user }: { user: TUser }) => {
)}
/>
{/* disabled email field */}
<div className="mt-4 space-y-2">
<Label htmlFor="email">{t("common.email")}</Label>
<Input type="email" id="email" defaultValue={user.email} disabled />
@@ -145,6 +148,9 @@ export const EditProfileDetailsForm = ({ user }: { user: TUser }) => {
<div className="mt-4 space-y-2">
<Label htmlFor="reset-password">{t("auth.forgot-password.reset_password")}</Label>
<p className="mt-1 text-sm text-slate-500">
{t("auth.forgot-password.reset_password_description")}
</p>
<div className="flex items-center justify-between gap-2">
<Input type="email" id="reset-password" defaultValue={user.email} disabled />
<Button

View File

@@ -23,7 +23,8 @@
"text": "Du kannst Dich jetzt mit deinem neuen Passwort einloggen"
}
},
"reset_password": "Passwort zurücksetzen"
"reset_password": "Passwort zurücksetzen",
"reset_password_description": "Sie werden abgemeldet, um Ihr Passwort zurückzusetzen."
},
"invite": {
"create_account": "Konto erstellen",

View File

@@ -23,7 +23,8 @@
"text": "You can now log in with your new password"
}
},
"reset_password": "Reset password"
"reset_password": "Reset password",
"reset_password_description": "You will be logged out to reset your password."
},
"invite": {
"create_account": "Create an account",

View File

@@ -23,7 +23,8 @@
"text": "Vous pouvez maintenant vous connecter avec votre nouveau mot de passe."
}
},
"reset_password": "Réinitialiser le mot de passe"
"reset_password": "Réinitialiser le mot de passe",
"reset_password_description": "Vous serez déconnecté pour réinitialiser votre mot de passe."
},
"invite": {
"create_account": "Créer un compte",

View File

@@ -23,7 +23,8 @@
"text": "Agora você pode fazer login com sua nova senha"
}
},
"reset_password": "Redefinir senha"
"reset_password": "Redefinir senha",
"reset_password_description": "Você será desconectado para redefinir sua senha."
},
"invite": {
"create_account": "Cria uma conta",

View File

@@ -23,7 +23,8 @@
"text": "Pode agora iniciar sessão com a sua nova palavra-passe"
}
},
"reset_password": "Redefinir palavra-passe"
"reset_password": "Redefinir palavra-passe",
"reset_password_description": "Será desconectado para redefinir a sua senha."
},
"invite": {
"create_account": "Criar uma conta",

View File

@@ -23,7 +23,8 @@
"text": "您現在可以使用新密碼登入"
}
},
"reset_password": "重設密碼"
"reset_password": "重設密碼",
"reset_password_description": "您將被註銷以重設您的密碼。"
},
"invite": {
"create_account": "建立帳戶",