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 { 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,31 +266,27 @@ export default function Login() {
|
||||
{isSubmitting ? "Logging in..." : "Login"}
|
||||
</button>
|
||||
|
||||
{/* Google登录按钮 - 根据服务端配置显示/隐藏 */}
|
||||
{showGoogleLogin && (
|
||||
<>
|
||||
<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>
|
||||
<div className="flex-grow border-t border-gray-500/30"></div>
|
||||
</div>
|
||||
{/* 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>
|
||||
<div className="flex-grow border-t border-gray-500/30"></div>
|
||||
</div>
|
||||
|
||||
<GoogleLoginButton
|
||||
onClick={handleGoogleSignIn}
|
||||
loading={googleLoading}
|
||||
disabled={isSubmitting}
|
||||
variant="outline"
|
||||
size="md"
|
||||
className="w-full"
|
||||
label="Sign in with Google"
|
||||
loadingLabel="Signing in..."
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<GoogleLoginButton
|
||||
onClick={handleGoogleSignIn}
|
||||
loading={googleLoading}
|
||||
disabled={isSubmitting}
|
||||
variant="outline"
|
||||
size="md"
|
||||
className="w-full"
|
||||
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't have an account?{" "}
|
||||
<Link href="/signup" className="auth-link !text-[#C039F6]">
|
||||
Sign up
|
||||
</Link>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user