mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-17 10:11:31 +10:00
feat(feature-flags): fixes #1592, introduces new flags DISABLE_SIGNUPS and DISABLE_EMAIL_AUTH, renamed STORAGE_SKIP_BUCKET_CHECK
This commit is contained in:
@ -4,6 +4,8 @@ import { ArrowRight } from "@phosphor-icons/react";
|
||||
import { loginSchema } from "@reactive-resume/dto";
|
||||
import { usePasswordToggle } from "@reactive-resume/hooks";
|
||||
import {
|
||||
Alert,
|
||||
AlertTitle,
|
||||
Button,
|
||||
Form,
|
||||
FormControl,
|
||||
@ -22,15 +24,13 @@ import { Link } from "react-router-dom";
|
||||
import { z } from "zod";
|
||||
|
||||
import { useLogin } from "@/client/services/auth";
|
||||
import { useAuthProviders } from "@/client/services/auth/providers";
|
||||
import { useFeatureFlags } from "@/client/services/feature";
|
||||
|
||||
type FormValues = z.infer<typeof loginSchema>;
|
||||
|
||||
export const LoginPage = () => {
|
||||
const { login, loading } = useLogin();
|
||||
|
||||
const { providers } = useAuthProviders();
|
||||
const emailAuthDisabled = !providers?.includes("email");
|
||||
const { flags } = useFeatureFlags();
|
||||
|
||||
const formRef = useRef<HTMLFormElement>(null);
|
||||
usePasswordToggle(formRef);
|
||||
@ -58,7 +58,7 @@ export const LoginPage = () => {
|
||||
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl font-semibold tracking-tight">{t`Sign in to your account`}</h2>
|
||||
<h6 className={cn(emailAuthDisabled && "hidden")}>
|
||||
<h6>
|
||||
<span className="opacity-75">{t`Don't have an account?`}</span>
|
||||
<Button asChild variant="link" className="px-1.5">
|
||||
<Link to="/auth/register">
|
||||
@ -69,7 +69,13 @@ export const LoginPage = () => {
|
||||
</h6>
|
||||
</div>
|
||||
|
||||
<div className={cn(emailAuthDisabled && "hidden")}>
|
||||
{flags.isEmailAuthDisabled && (
|
||||
<Alert variant="error">
|
||||
<AlertTitle>{t`Signing in via email is currently disabled by the administrator.`}</AlertTitle>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<div className={cn(flags.isEmailAuthDisabled && "pointer-events-none select-none blur-sm")}>
|
||||
<Form {...form}>
|
||||
<form
|
||||
ref={formRef}
|
||||
|
||||
@ -24,17 +24,14 @@ import { Link, useNavigate } from "react-router-dom";
|
||||
import { z } from "zod";
|
||||
|
||||
import { useRegister } from "@/client/services/auth";
|
||||
import { useAuthProviders } from "@/client/services/auth/providers";
|
||||
import { useFeatureFlags } from "@/client/services/feature";
|
||||
|
||||
type FormValues = z.infer<typeof registerSchema>;
|
||||
|
||||
export const RegisterPage = () => {
|
||||
const navigate = useNavigate();
|
||||
const { flags } = useFeatureFlags();
|
||||
const { register, loading } = useRegister();
|
||||
const disableSignups = import.meta.env.VITE_DISABLE_SIGNUPS === "true";
|
||||
|
||||
const { providers } = useAuthProviders();
|
||||
const emailAuthDisabled = !providers?.includes("email");
|
||||
|
||||
const formRef = useRef<HTMLFormElement>(null);
|
||||
usePasswordToggle(formRef);
|
||||
@ -70,7 +67,7 @@ export const RegisterPage = () => {
|
||||
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl font-semibold tracking-tight">{t`Create a new account`}</h2>
|
||||
<h6 className={cn(emailAuthDisabled && "hidden")}>
|
||||
<h6>
|
||||
<span className="opacity-75">{t`Already have an account?`}</span>
|
||||
<Button asChild variant="link" className="px-1.5">
|
||||
<Link to="/auth/login">
|
||||
@ -80,18 +77,13 @@ export const RegisterPage = () => {
|
||||
</h6>
|
||||
</div>
|
||||
|
||||
{disableSignups && (
|
||||
{flags.isSignupsDisabled && (
|
||||
<Alert variant="error">
|
||||
<AlertTitle>{t`Signups are currently disabled by the administrator.`}</AlertTitle>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={cn(
|
||||
emailAuthDisabled && "hidden",
|
||||
disableSignups && "pointer-events-none blur-sm",
|
||||
)}
|
||||
>
|
||||
<div className={cn(flags.isSignupsDisabled && "pointer-events-none select-none blur-sm")}>
|
||||
<Form {...form}>
|
||||
<form
|
||||
ref={formRef}
|
||||
|
||||
Reference in New Issue
Block a user