登录页面谷歌登录按钮去掉sso_config判断逻辑

This commit is contained in:
qikongjian 2025-10-23 19:34:30 +08:00
parent 3b97e4ea19
commit 796975de80

View File

@ -9,7 +9,6 @@ import { signInWithGoogle, loginUser } from "@/lib/auth";
import { GradientText } from "@/components/ui/gradient-text";
import { GoogleLoginButton } from "@/components/ui/google-login-button";
import { Eye, EyeOff } from "lucide-react";
import { isGoogleLoginEnabled } from "@/lib/server-config";
import Footer from "@/components/common/Footer";
import { useDeviceType } from "@/hooks/useDeviceType";
@ -24,7 +23,6 @@ export default function Login() {
const [googleLoading, setGoogleLoading] = useState(false);
const [emailFocused, setEmailFocused] = useState(false);
const [passwordFocused, setPasswordFocused] = useState(false);
const [showGoogleLogin, setShowGoogleLogin] = useState(false);
const router = useRouter();
const searchParams = useSearchParams();
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]);
const handleGoogleSignIn = async () => {
@ -283,9 +266,7 @@ export default function Login() {
{isSubmitting ? "Logging in..." : "Login"}
</button>
{/* Google登录按钮 - 根据服务端配置显示/隐藏 */}
{showGoogleLogin && (
<>
{/* Google登录按钮 */}
<div className="my-4 relative flex items-center">
<div className="flex-grow border-t border-gray-500/30"></div>
<span className="flex-shrink mx-4 text-gray-400">or</span>
@ -302,12 +283,10 @@ export default function Login() {
label="Sign in with Google"
loadingLabel="Signing in..."
/>
</>
)}
<div className="text-center mt-4">
<p style={{ color: "rgba(255, 255, 255, 0.6)" }}>
Don't have an account?{" "}
Don&apos;t have an account?{" "}
<Link href="/signup" className="auth-link !text-[#C039F6]">
Sign up
</Link>