small improvements

This commit is contained in:
daniel31x13 2024-05-16 15:50:43 -04:00
parent f68ca100a1
commit 142af9b5c0
3 changed files with 21 additions and 7 deletions

View File

@ -26,11 +26,17 @@ export default function EmailChangeVerificationModal({
<div className="flex flex-col gap-5">
<p>
Please confirm your password before changing your email address.{" "}
{process.env.NEXT_PUBLIC_STRIPE === "true"
? "Updating this field will change your billing email on Stripe as well."
: undefined}
{process.env.NEXT_PUBLIC_STRIPE === "true" &&
"Updating this field will change your billing email on Stripe as well."}
</p>
{process.env.NEXT_PUBLIC_GOOGLE_ENABLED === "true" && (
<p>
If you change your email address, any existing Google SSO
connections will be removed.
</p>
)}
<div>
<p>Old Email</p>
<p className="text-neutral">{oldEmail}</p>

View File

@ -148,7 +148,11 @@ export default async function updateUserById(
};
}
sendChangeEmailVerificationRequest(user.email, data.email, data.name);
sendChangeEmailVerificationRequest(
user.email,
data.email,
data.name.trim()
);
}
// Other settings / Apply changes
@ -161,7 +165,7 @@ export default async function updateUserById(
id: userId,
},
data: {
name: data.name,
name: data.name.trim(),
username: data.username?.toLowerCase().trim(),
isPrivate: data.isPrivate,
image:

View File

@ -1,3 +1,4 @@
import { signOut } from "next-auth/react";
import { useRouter } from "next/router";
import { useEffect } from "react";
import toast from "react-hot-toast";
@ -18,7 +19,10 @@ const VerifyEmail = () => {
method: "POST",
}).then((res) => {
if (res.ok) {
toast.success("Email verified. You can now login.");
toast.success("Email verified. Signing out..");
setTimeout(() => {
signOut();
}, 3000);
} else {
toast.error("Invalid token.");
}
@ -27,7 +31,7 @@ const VerifyEmail = () => {
console.log(token);
}, []);
return <div>Verify email...</div>;
return <></>;
};
export default VerifyEmail;