small improvements
This commit is contained in:
parent
f68ca100a1
commit
142af9b5c0
|
@ -26,11 +26,17 @@ export default function EmailChangeVerificationModal({
|
||||||
<div className="flex flex-col gap-5">
|
<div className="flex flex-col gap-5">
|
||||||
<p>
|
<p>
|
||||||
Please confirm your password before changing your email address.{" "}
|
Please confirm your password before changing your email address.{" "}
|
||||||
{process.env.NEXT_PUBLIC_STRIPE === "true"
|
{process.env.NEXT_PUBLIC_STRIPE === "true" &&
|
||||||
? "Updating this field will change your billing email on Stripe as well."
|
"Updating this field will change your billing email on Stripe as well."}
|
||||||
: undefined}
|
|
||||||
</p>
|
</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>
|
<div>
|
||||||
<p>Old Email</p>
|
<p>Old Email</p>
|
||||||
<p className="text-neutral">{oldEmail}</p>
|
<p className="text-neutral">{oldEmail}</p>
|
||||||
|
|
|
@ -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
|
// Other settings / Apply changes
|
||||||
|
@ -161,7 +165,7 @@ export default async function updateUserById(
|
||||||
id: userId,
|
id: userId,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
name: data.name,
|
name: data.name.trim(),
|
||||||
username: data.username?.toLowerCase().trim(),
|
username: data.username?.toLowerCase().trim(),
|
||||||
isPrivate: data.isPrivate,
|
isPrivate: data.isPrivate,
|
||||||
image:
|
image:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { signOut } from "next-auth/react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
|
@ -18,7 +19,10 @@ const VerifyEmail = () => {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
toast.success("Email verified. You can now login.");
|
toast.success("Email verified. Signing out..");
|
||||||
|
setTimeout(() => {
|
||||||
|
signOut();
|
||||||
|
}, 3000);
|
||||||
} else {
|
} else {
|
||||||
toast.error("Invalid token.");
|
toast.error("Invalid token.");
|
||||||
}
|
}
|
||||||
|
@ -27,7 +31,7 @@ const VerifyEmail = () => {
|
||||||
console.log(token);
|
console.log(token);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return <div>Verify email...</div>;
|
return <></>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default VerifyEmail;
|
export default VerifyEmail;
|
||||||
|
|
Ŝarĝante…
Reference in New Issue