{user.name}
+ {user.isAdmin && ( + + Admin + + )} + {user.isSuspended && ( + + Suspended + + )} ++ @{user.username} ยท {user.email} +
++ Joined {new Date(user.createdAt).toLocaleDateString()} +
+- To get Your Questions answered -
-+ It seems you've previously created an account using your email and password. +
++ You can link your {providerName[provider]} login after confirming your existing account. +
++ Your existing account stays the same, and you can keep signing in with either method. +
+ + + > + ) : ( + <> ++ Sign in with your DevFlow email and password to authorize linking your {providerName[provider]} account. +
+ + > + )} +{form.formState.errors.root.message}
)} diff --git a/features/auth/components/AuthPanel.tsx b/features/auth/components/AuthPanel.tsx new file mode 100644 index 0000000..84a13c4 --- /dev/null +++ b/features/auth/components/AuthPanel.tsx @@ -0,0 +1,38 @@ +import Image from "next/image" +import { ReactNode } from "react" + +import SocialAuthForm from "./SocialAuthForm" + +type AuthPanelProps = { + title: string + description: string + children: ReactNode + showSocialAuth?: boolean +} + +export function AuthPanel({ + title, + description, + children, + showSocialAuth = false +}: AuthPanelProps) { + return ( +{description}
++ No worries, we'll send you reset instructions. +
+ + > + ) : ( + <> ++ If an account exists for {sentTo}, we sent a password + reset link. +
+ + {notice &&{notice}
} + {error &&{error}
} + > + )} + + โ Back to login + ++ Your password has been changed. You can now sign in with your new password. +
+ + Back to login + + > + ) : ( + <> ++ Enter a new password for your DevFlow account. +
+ + > + )} ++ Your password has been updated. You can sign in now. +
+ )} +Hi ${escapeHtml(params.name)},
Use this link to reset your DevFlow password. It expires in one hour and can only be used once.
If you did not request this, you can ignore this email.
` + }) + }) + + if (!response.ok) { + const responseBody = await response.text() + logger.error( + { status: response.status, response: responseBody }, + "Resend rejected a password reset email" + ) + throw new Error("Email delivery failed.") + } +} + +function escapeHtml(value: string) { + return value.replace(/[&<>"']/g, (character) => { + const entities: Record+ @{user.username} ยท {user.email} +
++ Joined {new Date(user.createdAt).toLocaleDateString()} +
+Administration
++ Search accounts, update profile details, and manage account access. +
++ {result.error} +
+ ) : result.data?.length ? ( + <> ++ {result.data.length === 100 + ? "Showing the 100 most recently created matching accounts." + : `${result.data.length} account${result.data.length === 1 ? "" : "s"} found.`} +
++ No users match this search. +
+ )} +