mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
Revert "redirect authenticated users from landing, login, and register to dashboard"
This reverts commit c3bd035e6d.
This commit is contained in:
parent
c3bd035e6d
commit
4e800c8824
3 changed files with 1 additions and 27 deletions
|
|
@ -1,14 +1,13 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { AnimatePresence, motion } from "motion/react";
|
import { AnimatePresence, motion } from "motion/react";
|
||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { Suspense, useEffect, useState } from "react";
|
import { Suspense, useEffect, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { Logo } from "@/components/Logo";
|
import { Logo } from "@/components/Logo";
|
||||||
import { useGlobalLoadingEffect } from "@/hooks/use-global-loading";
|
import { useGlobalLoadingEffect } from "@/hooks/use-global-loading";
|
||||||
import { getAuthErrorDetails, shouldRetry } from "@/lib/auth-errors";
|
import { getAuthErrorDetails, shouldRetry } from "@/lib/auth-errors";
|
||||||
import { getBearerToken } from "@/lib/auth-utils";
|
|
||||||
import { AUTH_TYPE } from "@/lib/env-config";
|
import { AUTH_TYPE } from "@/lib/env-config";
|
||||||
import { AmbientBackground } from "./AmbientBackground";
|
import { AmbientBackground } from "./AmbientBackground";
|
||||||
import { GoogleLoginButton } from "./GoogleLoginButton";
|
import { GoogleLoginButton } from "./GoogleLoginButton";
|
||||||
|
|
@ -17,19 +16,11 @@ import { LocalLoginForm } from "./LocalLoginForm";
|
||||||
function LoginContent() {
|
function LoginContent() {
|
||||||
const t = useTranslations("auth");
|
const t = useTranslations("auth");
|
||||||
const tCommon = useTranslations("common");
|
const tCommon = useTranslations("common");
|
||||||
const router = useRouter();
|
|
||||||
const [authType, setAuthType] = useState<string | null>(null);
|
const [authType, setAuthType] = useState<string | null>(null);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [urlError, setUrlError] = useState<{ title: string; message: string } | null>(null);
|
const [urlError, setUrlError] = useState<{ title: string; message: string } | null>(null);
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (getBearerToken()) {
|
|
||||||
router.replace("/dashboard");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, [router]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Check for various URL parameters that might indicate success or error states
|
// Check for various URL parameters that might indicate success or error states
|
||||||
const registered = searchParams.get("registered");
|
const registered = searchParams.get("registered");
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { getBearerToken } from "@/lib/auth-utils";
|
|
||||||
import { HeroSection } from "@/components/homepage/hero-section";
|
import { HeroSection } from "@/components/homepage/hero-section";
|
||||||
|
|
||||||
const FeaturesCards = dynamic(
|
const FeaturesCards = dynamic(
|
||||||
|
|
@ -29,14 +26,6 @@ const CTAHomepage = dynamic(
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (getBearerToken()) {
|
|
||||||
router.replace("/dashboard");
|
|
||||||
}
|
|
||||||
}, [router]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="min-h-screen bg-gradient-to-b from-gray-50 to-gray-100 text-gray-900 dark:from-black dark:to-gray-900 dark:text-white">
|
<main className="min-h-screen bg-gradient-to-b from-gray-50 to-gray-100 text-gray-900 dark:from-black dark:to-gray-900 dark:text-white">
|
||||||
<HeroSection />
|
<HeroSection />
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import { registerMutationAtom } from "@/atoms/auth/auth-mutation.atoms";
|
||||||
import { Logo } from "@/components/Logo";
|
import { Logo } from "@/components/Logo";
|
||||||
import { Spinner } from "@/components/ui/spinner";
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
import { getAuthErrorDetails, isNetworkError, shouldRetry } from "@/lib/auth-errors";
|
import { getAuthErrorDetails, isNetworkError, shouldRetry } from "@/lib/auth-errors";
|
||||||
import { getBearerToken } from "@/lib/auth-utils";
|
|
||||||
import { AUTH_TYPE } from "@/lib/env-config";
|
import { AUTH_TYPE } from "@/lib/env-config";
|
||||||
import { AppError, ValidationError } from "@/lib/error";
|
import { AppError, ValidationError } from "@/lib/error";
|
||||||
import {
|
import {
|
||||||
|
|
@ -24,7 +23,6 @@ import { AmbientBackground } from "../login/AmbientBackground";
|
||||||
export default function RegisterPage() {
|
export default function RegisterPage() {
|
||||||
const t = useTranslations("auth");
|
const t = useTranslations("auth");
|
||||||
const tCommon = useTranslations("common");
|
const tCommon = useTranslations("common");
|
||||||
|
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [confirmPassword, setConfirmPassword] = useState("");
|
const [confirmPassword, setConfirmPassword] = useState("");
|
||||||
|
|
@ -40,10 +38,6 @@ export default function RegisterPage() {
|
||||||
|
|
||||||
// Check authentication type and redirect if not LOCAL
|
// Check authentication type and redirect if not LOCAL
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (getBearerToken()) {
|
|
||||||
router.replace("/dashboard");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (AUTH_TYPE !== "LOCAL") {
|
if (AUTH_TYPE !== "LOCAL") {
|
||||||
router.push("/login");
|
router.push("/login");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue