Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

major bug fixed

Daniel1bb1d8140d35
diff --git a/hooks/useInitialData.tsx b/hooks/useInitialData.tsx
index b79d5a82..a0bd1c44 100644
--- a/hooks/useInitialData.tsx
+++ b/hooks/useInitialData.tsx
@@ -13,7 +13,10 @@ export default function useInitialData() {
const { setAccount } = useAccountStore();
useEffect(() => {
- if (status === "authenticated" && data.user.isSubscriber) {
+ if (
+ status === "authenticated" &&
+ (!process.env.NEXT_PUBLIC_STRIPE_IS_ACTIVE || data.user.isSubscriber)
+ ) {
setCollections();
setTags();
// setLinks();
diff --git a/pages/register.tsx b/pages/register.tsx
index d02ddbc3..d2236abe 100644
--- a/pages/register.tsx
+++ b/pages/register.tsx
@@ -3,7 +3,7 @@ import { useState } from "react";
import { toast } from "react-hot-toast";
import SubmitButton from "@/components/SubmitButton";
import { signIn } from "next-auth/react";
-import Image from "next/image";
+import { useRouter } from "next/router";
import CenteredForm from "@/layouts/CenteredForm";
const emailEnabled = process.env.NEXT_PUBLIC_EMAIL_PROVIDER;
@@ -18,6 +18,7 @@ type FormData = {
export default function Register() {
const [submitLoader, setSubmitLoader] = useState(false);
+ const router = useRouter();
const [form, setForm] = useState<FormData>({
name: "",
@@ -28,7 +29,7 @@ export default function Register() {
});
async function registerUser() {
- const checkHasEmptyFields = () => {
+ const checkFields = () => {
if (emailEnabled) {
return (
form.name !== "" &&
@@ -46,14 +47,7 @@ export default function Register() {
}
};
- const sendConfirmation = async () => {
- await signIn("email", {
- email: form.email,
- callbackUrl: "/",
- });
- };
-
- if (checkHasEmptyFields()) {
+ if (checkFields()) {
if (form.password !== form.passwordConfirmation)
return toast.error("Passwords do not match.");
else if (form.password.length < 8)
@@ -78,7 +72,12 @@ export default function Register() {
setSubmitLoader(false);
if (response.ok) {
- if (form.email) await sendConfirmation();
+ if (form.email && emailEnabled)
+ await signIn("email", {
+ email: form.email,
+ callbackUrl: "/",
+ });
+ else if (!emailEnabled) router.push("/login");
toast.success("User Created!");
} else {