fix: show register entry in new login dialog
This commit is contained in:
parent
9ce3076438
commit
2c0a5379e7
@ -129,6 +129,7 @@ type PublicAuthSettings = {
|
|||||||
isDingTalkEnabled?: boolean;
|
isDingTalkEnabled?: boolean;
|
||||||
isGoogleEnabled?: boolean;
|
isGoogleEnabled?: boolean;
|
||||||
isGoogleConfigured?: boolean;
|
isGoogleConfigured?: boolean;
|
||||||
|
isRegistrationEnabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ContactConfig = {
|
type ContactConfig = {
|
||||||
@ -643,6 +644,7 @@ export function LovartHome({
|
|||||||
authSettingsData?.isGoogleEnabled && authSettingsData?.isGoogleConfigured
|
authSettingsData?.isGoogleEnabled && authSettingsData?.isGoogleConfigured
|
||||||
);
|
);
|
||||||
const canUseDingTalkLogin = Boolean(authSettingsData?.isDingTalkEnabled);
|
const canUseDingTalkLogin = Boolean(authSettingsData?.isDingTalkEnabled);
|
||||||
|
const canUseRegistration = authSettingsData?.isRegistrationEnabled !== false;
|
||||||
const hasThirdPartyLoginOptions = canUseGoogleLogin || canUseDingTalkLogin;
|
const hasThirdPartyLoginOptions = canUseGoogleLogin || canUseDingTalkLogin;
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
@ -892,6 +894,15 @@ export function LovartHome({
|
|||||||
window.location.href = "/api/auth/dingtalk/login";
|
window.location.href = "/api/auth/dingtalk/login";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRegister = () => {
|
||||||
|
if (!canUseRegistration) {
|
||||||
|
toast.error("当前未开放注册");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoginDialogOpen(false);
|
||||||
|
router.push("/register");
|
||||||
|
};
|
||||||
|
|
||||||
const handleOpenImageEditor = () => {
|
const handleOpenImageEditor = () => {
|
||||||
if (!isAuthenticated) {
|
if (!isAuthenticated) {
|
||||||
openLoginDialog();
|
openLoginDialog();
|
||||||
@ -1959,7 +1970,9 @@ export function LovartHome({
|
|||||||
|
|
||||||
<div className="mb-5 text-center">
|
<div className="mb-5 text-center">
|
||||||
<h3 className="text-[18px] font-semibold text-black">欢迎来到 {siteName}</h3>
|
<h3 className="text-[18px] font-semibold text-black">欢迎来到 {siteName}</h3>
|
||||||
<p className="mt-2 text-[13px] text-black/45">登录或注册以继续</p>
|
<p className="mt-2 text-[13px] text-black/45">
|
||||||
|
{canUseRegistration ? "登录或注册以继续" : "登录以继续"}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{hasThirdPartyLoginOptions ? (
|
{hasThirdPartyLoginOptions ? (
|
||||||
@ -2029,6 +2042,19 @@ export function LovartHome({
|
|||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{canUseRegistration ? (
|
||||||
|
<div className="mt-3 text-center text-[13px] text-black/55">
|
||||||
|
还没有账号?
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="ml-1 font-medium text-black hover:underline"
|
||||||
|
onClick={handleRegister}
|
||||||
|
>
|
||||||
|
立即注册
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<p className="mt-4 text-center text-xs text-black/40">
|
<p className="mt-4 text-center text-xs text-black/40">
|
||||||
继续即表示您同意使用条款和隐私政策
|
继续即表示您同意使用条款和隐私政策
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user