code refactoring + many security/bug fixes
This commit is contained in:
@@ -86,20 +86,6 @@ export default function Account() {
|
||||
|
||||
if (response.ok) {
|
||||
toast.success("Settings Applied!");
|
||||
|
||||
// if (user.email !== account.email) {
|
||||
// update({
|
||||
// id: data?.user.id,
|
||||
// });
|
||||
|
||||
// signOut();
|
||||
// } else if (
|
||||
// user.username !== account.username ||
|
||||
// user.name !== account.name
|
||||
// )
|
||||
// update({
|
||||
// id: data?.user.id,
|
||||
// });
|
||||
} else toast.error(response.data as string);
|
||||
setSubmitLoader(false);
|
||||
};
|
||||
@@ -190,7 +176,7 @@ export default function Account() {
|
||||
<div>
|
||||
<p className="text-black dark:text-white mb-2">Email</p>
|
||||
{user.email !== account.email &&
|
||||
process.env.NEXT_PUBLIC_STRIPE_IS_ACTIVE === "true" ? (
|
||||
process.env.NEXT_PUBLIC_STRIPE === "true" ? (
|
||||
<p className="text-gray-500 dark:text-gray-400 mb-2 text-sm">
|
||||
Updating this field will change your billing email as well
|
||||
</p>
|
||||
@@ -388,7 +374,7 @@ export default function Account() {
|
||||
<p>
|
||||
This will permanently delete ALL the Links, Collections, Tags, and
|
||||
archived data you own.{" "}
|
||||
{process.env.NEXT_PUBLIC_STRIPE_IS_ACTIVE
|
||||
{process.env.NEXT_PUBLIC_STRIPE
|
||||
? "It will also cancel your subscription. "
|
||||
: undefined}{" "}
|
||||
You will be prompted to enter your password before the deletion
|
||||
|
||||
@@ -6,8 +6,7 @@ export default function Billing() {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
if (!process.env.NEXT_PUBLIC_STRIPE_IS_ACTIVE)
|
||||
router.push("/settings/profile");
|
||||
if (!process.env.NEXT_PUBLIC_STRIPE) router.push("/settings/profile");
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
@@ -72,7 +72,7 @@ export default function Password() {
|
||||
<p>
|
||||
This will permanently delete all the Links, Collections, Tags, and
|
||||
archived data you own. It will also log you out
|
||||
{process.env.NEXT_PUBLIC_STRIPE_IS_ACTIVE
|
||||
{process.env.NEXT_PUBLIC_STRIPE
|
||||
? " and cancel your subscription"
|
||||
: undefined}
|
||||
. This action is irreversible!
|
||||
@@ -91,7 +91,7 @@ export default function Password() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{process.env.NEXT_PUBLIC_STRIPE_IS_ACTIVE ? (
|
||||
{process.env.NEXT_PUBLIC_STRIPE ? (
|
||||
<fieldset className="border rounded-md p-2 border-sky-500">
|
||||
<legend className="px-3 py-1 text-sm sm:text-base border rounded-md border-sky-500">
|
||||
<b>Optional</b>{" "}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import SettingsLayout from "@/layouts/SettingsLayout";
|
||||
import { useState } from "react";
|
||||
import useAccountStore from "@/store/account";
|
||||
import { faPenToSquare } from "@fortawesome/free-regular-svg-icons";
|
||||
import SubmitButton from "@/components/SubmitButton";
|
||||
import { toast } from "react-hot-toast";
|
||||
import TextInput from "@/components/TextInput";
|
||||
|
||||
Reference in New Issue
Block a user