diff --git a/packages/admin/dashboard/src/routes/invite/invite.tsx b/packages/admin/dashboard/src/routes/invite/invite.tsx
index 6baf549e87..5535a0ae56 100644
--- a/packages/admin/dashboard/src/routes/invite/invite.tsx
+++ b/packages/admin/dashboard/src/routes/invite/invite.tsx
@@ -10,7 +10,6 @@ import { Link, useSearchParams } from "react-router-dom"
import * as z from "zod"
import { Form } from "../../components/common/form"
import AvatarBox from "../../components/common/logo-box/avatar-box"
-import { KeyboundForm } from "../../components/utilities/keybound-form"
import { useSignUpWithEmailPass } from "../../hooks/api/auth"
import { useAcceptInvite } from "../../hooks/api/invites"
import { isFetchError } from "../../lib/is-fetch-error"
@@ -140,7 +139,7 @@ const LoginLink = () => {
{t("invite.backToLogin")}
@@ -251,10 +250,7 @@ const CreateView = ({
{getWidgets("login.after").map((Component, i) => {
return
diff --git a/packages/admin/dashboard/src/routes/reset-password/reset-password.tsx b/packages/admin/dashboard/src/routes/reset-password/reset-password.tsx
index 9e56e27b70..773cfd7e59 100644
--- a/packages/admin/dashboard/src/routes/reset-password/reset-password.tsx
+++ b/packages/admin/dashboard/src/routes/reset-password/reset-password.tsx
@@ -10,7 +10,6 @@ import { decodeToken } from "react-jwt"
import { Form } from "../../components/common/form"
import { LogoBox } from "../../components/common/logo-box"
import { i18n } from "../../components/utilities/i18n"
-import { KeyboundForm } from "../../components/utilities/keybound-form"
import {
useResetPasswordForEmailPass,
useUpdateProviderForEmailPass,
@@ -118,19 +117,26 @@ const ChooseNewPassword = ({ token }: { token: string }) => {
const { mutateAsync, isPending } = useUpdateProviderForEmailPass()
const handleSubmit = form.handleSubmit(async ({ password }) => {
- try {
- await mutateAsync({
+ if (!invite) {
+ return
+ }
+
+ await mutateAsync(
+ {
email: invite.entity_id,
password,
- })
-
- form.setValue("password", "")
- form.setValue("repeat_password", "")
-
- setShowAlert(true)
- } catch (error) {
- toast.error(error.message)
- }
+ },
+ {
+ onSuccess: () => {
+ form.setValue("password", "")
+ form.setValue("repeat_password", "")
+ setShowAlert(true)
+ },
+ onError: (error) => {
+ toast.error(error.message)
+ },
+ }
+ )
})
if (!isValidResetPasswordToken) {
@@ -138,8 +144,8 @@ const ChooseNewPassword = ({ token }: { token: string }) => {
}
return (
-
-
+
+
{t("resetPassword.resetPassword")}
@@ -149,7 +155,7 @@ const ChooseNewPassword = ({ token }: { token: string }) => {
@@ -219,7 +225,7 @@ const ChooseNewPassword = ({ token }: { token: string }) => {
,
]}
/>
@@ -246,15 +252,20 @@ export const ResetPassword = () => {
const { mutateAsync, isPending } = useResetPasswordForEmailPass()
const handleSubmit = form.handleSubmit(async ({ email }) => {
- try {
- await mutateAsync({
+ await mutateAsync(
+ {
email,
- })
- form.setValue("email", "")
- setShowAlert(true)
- } catch (error) {
- toast.error(error.message)
- }
+ },
+ {
+ onSuccess: () => {
+ form.setValue("email", "")
+ setShowAlert(true)
+ },
+ onError: (error) => {
+ toast.error(error.message)
+ },
+ }
+ )
})
if (token) {
@@ -273,7 +284,7 @@ export const ResetPassword = () => {
@@ -320,7 +331,7 @@ export const ResetPassword = () => {
,
]}
/>