mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: disable register,link/unlink
This commit is contained in:
@@ -8,6 +8,7 @@ import Link from "next/link";
|
|||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { CardAuth } from "@/features/layout/card-auth";
|
import { CardAuth } from "@/features/layout/card-auth";
|
||||||
import { env } from "@/env.mjs";
|
import { env } from "@/env.mjs";
|
||||||
|
import { en } from "zod/v4/locales";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Login",
|
title: "Login",
|
||||||
@@ -43,14 +44,15 @@ export default async function SignInPage() {
|
|||||||
{SUPPORTED_PROVIDERS.filter((p) => !p.isManual && p.isActive).length >
|
{SUPPORTED_PROVIDERS.filter((p) => !p.isManual && p.isActive).length >
|
||||||
0 && <SocialAuthButtons providers={SUPPORTED_PROVIDERS} />}
|
0 && <SocialAuthButtons providers={SUPPORTED_PROVIDERS} />}
|
||||||
|
|
||||||
{env.AUTH_SIGNUP_ENABLED === "true" && (
|
{env.AUTH_SIGNUP_ENABLED !== "true" ||
|
||||||
<div className="mt-4 text-center text-sm">
|
(env.AUTH_EMAIL_PASSWORD_ENABLED === "true" && (
|
||||||
Don't have an account ?{" "}
|
<div className="mt-4 text-center text-sm">
|
||||||
<Link href="/register" className="underline">
|
Don't have an account ?{" "}
|
||||||
Sign up
|
<Link href="/register" className="underline">
|
||||||
</Link>
|
Sign up
|
||||||
</div>
|
</Link>
|
||||||
)}
|
</div>
|
||||||
|
))}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</CardAuth>
|
</CardAuth>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
|
|||||||
@@ -5,17 +5,20 @@ import { redirect } from "next/navigation";
|
|||||||
import { env } from "@/env.mjs";
|
import { env } from "@/env.mjs";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Register",
|
title: "Register",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async function RoutePage(props: PageParams<{}>) {
|
export default async function RoutePage(props: PageParams<{}>) {
|
||||||
if (env.AUTH_SIGNUP_ENABLED !== "true") {
|
if (
|
||||||
redirect("/login");
|
env.AUTH_SIGNUP_ENABLED !== "true" ||
|
||||||
}
|
env.AUTH_EMAIL_PASSWORD_ENABLED !== "true"
|
||||||
|
) {
|
||||||
|
redirect("/login");
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto grid w-full gap-6">
|
<div className="mx-auto grid w-full gap-6">
|
||||||
<RegisterForm />
|
<RegisterForm />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,20 +55,12 @@ export function ProfileProviders({
|
|||||||
const { mutate: linkAccount } = useMutation({
|
const { mutate: linkAccount } = useMutation({
|
||||||
mutationFn: async (provider: AuthProviderConfig) => {
|
mutationFn: async (provider: AuthProviderConfig) => {
|
||||||
setLoadingProvider(provider.id);
|
setLoadingProvider(provider.id);
|
||||||
let result;
|
if (provider.type === "social") {
|
||||||
if (provider.type === "sso") {
|
await authClient.linkSocial({
|
||||||
result = await authClient.signIn.sso({
|
provider: provider.id as string,
|
||||||
providerId: provider.id,
|
|
||||||
providerType: "oidc",
|
|
||||||
callbackURL: "/dashboard",
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
result = await authClient.linkSocial({
|
|
||||||
provider: provider.id as any,
|
|
||||||
callbackURL: "/dashboard",
|
callbackURL: "/dashboard",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (result.error) throw result.error;
|
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
setLoadingProvider(null);
|
setLoadingProvider(null);
|
||||||
@@ -96,7 +88,10 @@ export function ProfileProviders({
|
|||||||
totalConnected > 1 || (totalConnected === 1 && !provider.isManual);
|
totalConnected > 1 || (totalConnected === 1 && !provider.isManual);
|
||||||
const isLoading = loadingProvider === provider.id;
|
const isLoading = loadingProvider === provider.id;
|
||||||
|
|
||||||
const isUnlinkDisabled = !canUnlink || provider.allowUnlinking === false;
|
const isUnlinkDisabled =
|
||||||
|
!canUnlink ||
|
||||||
|
provider.allowUnlinking === false ||
|
||||||
|
provider.type === "sso";
|
||||||
|
|
||||||
const unlinkButton = (
|
const unlinkButton = (
|
||||||
<Button
|
<Button
|
||||||
@@ -112,7 +107,9 @@ export function ProfileProviders({
|
|||||||
|
|
||||||
let actionElement;
|
let actionElement;
|
||||||
|
|
||||||
if (!isConnected) {
|
if (provider.type === "sso") {
|
||||||
|
actionElement = null;
|
||||||
|
} else if (!isConnected) {
|
||||||
actionElement =
|
actionElement =
|
||||||
provider.id === "credential" ? (
|
provider.id === "credential" ? (
|
||||||
<SetPasswordProfileProviderModal
|
<SetPasswordProfileProviderModal
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ export async function init() {
|
|||||||
(env.AUTH_GITHUB_ID && env.AUTH_GITHUB_SECRET)
|
(env.AUTH_GITHUB_ID && env.AUTH_GITHUB_SECRET)
|
||||||
) {
|
) {
|
||||||
console.warn(
|
console.warn(
|
||||||
"[Deprecation Warning] You have set up OAuth credentials in your environment variables, but the format is now different. Please update your environment variables to use the new format. For example, if you were using AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET, you should now use AUTH_GOOGLE_CLIENT and AUTH_GOOGLE_SECRET. Please refer to the documentation for more details.",
|
"[Deprecation Warning] You have set up OAuth credentials in your environment variables, but the format is now different. Please update your environment variables to use the new format. For example, if you were using AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET, you should now use AUTH_SOCIAL_GOOGLE_CLIENT and AUTH_SOCIAL_GOOGLE_SECRET. Please refer to the documentation for more details. (https://portabase.io/docs/dashboard/auth/oauth2/setup#dynamic-providers)",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user