forked from 77media/video-flow
登录页面谷歌登录按钮去掉sso_config判断逻辑
This commit is contained in:
parent
3b97e4ea19
commit
796975de80
@ -9,7 +9,6 @@ import { signInWithGoogle, loginUser } from "@/lib/auth";
|
|||||||
import { GradientText } from "@/components/ui/gradient-text";
|
import { GradientText } from "@/components/ui/gradient-text";
|
||||||
import { GoogleLoginButton } from "@/components/ui/google-login-button";
|
import { GoogleLoginButton } from "@/components/ui/google-login-button";
|
||||||
import { Eye, EyeOff } from "lucide-react";
|
import { Eye, EyeOff } from "lucide-react";
|
||||||
import { isGoogleLoginEnabled } from "@/lib/server-config";
|
|
||||||
import Footer from "@/components/common/Footer";
|
import Footer from "@/components/common/Footer";
|
||||||
import { useDeviceType } from "@/hooks/useDeviceType";
|
import { useDeviceType } from "@/hooks/useDeviceType";
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ export default function Login() {
|
|||||||
const [googleLoading, setGoogleLoading] = useState(false);
|
const [googleLoading, setGoogleLoading] = useState(false);
|
||||||
const [emailFocused, setEmailFocused] = useState(false);
|
const [emailFocused, setEmailFocused] = useState(false);
|
||||||
const [passwordFocused, setPasswordFocused] = useState(false);
|
const [passwordFocused, setPasswordFocused] = useState(false);
|
||||||
const [showGoogleLogin, setShowGoogleLogin] = useState(false);
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const { isMobile } = useDeviceType();
|
const { isMobile } = useDeviceType();
|
||||||
@ -82,21 +80,6 @@ export default function Login() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否启用Google登录
|
|
||||||
const checkGoogleLoginStatus = async () => {
|
|
||||||
try {
|
|
||||||
console.log('🔍 登录页面:开始检查Google登录状态...');
|
|
||||||
const enabled = await isGoogleLoginEnabled();
|
|
||||||
console.log('📋 登录页面:Google登录启用状态:', enabled);
|
|
||||||
setShowGoogleLogin(enabled);
|
|
||||||
console.log('📋 登录页面:设置showGoogleLogin状态为:', enabled);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("❌ 登录页面:Failed to check Google login status:", error);
|
|
||||||
setShowGoogleLogin(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
checkGoogleLoginStatus();
|
|
||||||
}, [searchParams]);
|
}, [searchParams]);
|
||||||
|
|
||||||
const handleGoogleSignIn = async () => {
|
const handleGoogleSignIn = async () => {
|
||||||
@ -283,31 +266,27 @@ export default function Login() {
|
|||||||
{isSubmitting ? "Logging in..." : "Login"}
|
{isSubmitting ? "Logging in..." : "Login"}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* Google登录按钮 - 根据服务端配置显示/隐藏 */}
|
{/* Google登录按钮 */}
|
||||||
{showGoogleLogin && (
|
<div className="my-4 relative flex items-center">
|
||||||
<>
|
<div className="flex-grow border-t border-gray-500/30"></div>
|
||||||
<div className="my-4 relative flex items-center">
|
<span className="flex-shrink mx-4 text-gray-400">or</span>
|
||||||
<div className="flex-grow border-t border-gray-500/30"></div>
|
<div className="flex-grow border-t border-gray-500/30"></div>
|
||||||
<span className="flex-shrink mx-4 text-gray-400">or</span>
|
</div>
|
||||||
<div className="flex-grow border-t border-gray-500/30"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<GoogleLoginButton
|
<GoogleLoginButton
|
||||||
onClick={handleGoogleSignIn}
|
onClick={handleGoogleSignIn}
|
||||||
loading={googleLoading}
|
loading={googleLoading}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="md"
|
size="md"
|
||||||
className="w-full"
|
className="w-full"
|
||||||
label="Sign in with Google"
|
label="Sign in with Google"
|
||||||
loadingLabel="Signing in..."
|
loadingLabel="Signing in..."
|
||||||
/>
|
/>
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="text-center mt-4">
|
<div className="text-center mt-4">
|
||||||
<p style={{ color: "rgba(255, 255, 255, 0.6)" }}>
|
<p style={{ color: "rgba(255, 255, 255, 0.6)" }}>
|
||||||
Don't have an account?{" "}
|
Don't have an account?{" "}
|
||||||
<Link href="/signup" className="auth-link !text-[#C039F6]">
|
<Link href="/signup" className="auth-link !text-[#C039F6]">
|
||||||
Sign up
|
Sign up
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user