Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/admin/src/actions/auth/start-otp-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const startOtpAction = actionClient
.schema(schema)
.action(async ({ parsedInput }): Promise<StartOtpActionResult> => {
const normalizedEmail = normalizeAuthEmail(parsedInput.email);
const allowlistAccess = await isPlatformAdminEmailAllowlisted(normalizedEmail);
const allowlistAccess =
await isPlatformAdminEmailAllowlisted(normalizedEmail);

if (allowlistAccess.unavailable) {
return { ok: false, errorCode: "auth-unavailable" };
Expand Down
6 changes: 4 additions & 2 deletions apps/admin/src/actions/auth/verify-otp-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { createClient } from "@v1/supabase/server";
import { redirect } from "next/navigation";
import { z } from "zod";

const GENERIC_AUTH_ERROR = "Unable to sign in. Please contact your administrator.";
const GENERIC_AUTH_ERROR =
"Unable to sign in. Please contact your administrator.";
const INVALID_OTP_ERROR = "Invalid verification code. Please try again.";
const RATE_LIMITED_ERROR = "Too many attempts. Please wait a moment and try again.";
const RATE_LIMITED_ERROR =
"Too many attempts. Please wait a moment and try again.";

const schema = z.object({
email: z.string().email("Please enter a valid email address"),
Expand Down
5 changes: 4 additions & 1 deletion apps/admin/src/components/animated-avelero-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export function AnimatedAveleroIcon({

return (
<span
className={cn("inline-flex items-center justify-center text-primary", className)}
className={cn(
"inline-flex items-center justify-center text-primary",
className,
)}
onMouseEnter={playAnimation}
onMouseLeave={stopAnimation}
aria-hidden="true"
Expand Down
16 changes: 12 additions & 4 deletions apps/admin/src/components/auth/google-signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { useSearchParams } from "next/navigation";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
const GENERIC_ERROR = "Unable to sign in. Please contact your administrator.";
const AUTH_FAILED_ERROR = "Authentication failed. Please try again.";
const RATE_LIMITED_ERROR = "Too many attempts. Please wait a moment and try again.";
const RATE_LIMITED_ERROR =
"Too many attempts. Please wait a moment and try again.";

function getQueryErrorMessage(errorCode: string | null): string | null {
if (errorCode === "auth-denied") return GENERIC_ERROR;
Expand All @@ -29,7 +30,9 @@ export function GoogleSignin() {

const [isSubmitting, setIsSubmitting] = useState(false);
const [isReady, setIsReady] = useState(false);
const [errorMessage, setErrorMessage] = useState<string | null>(queryErrorMessage);
const [errorMessage, setErrorMessage] = useState<string | null>(
queryErrorMessage,
);

const hiddenGoogleButtonRef = useRef<HTMLDivElement | null>(null);
const googleClientId = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID;
Expand Down Expand Up @@ -62,7 +65,10 @@ export function GoogleSignin() {
return;
}

const redirectTo = new URL("/api/auth/callback", window.location.origin);
const redirectTo = new URL(
"/api/auth/callback",
window.location.origin,
);
window.location.assign(redirectTo.toString());
} catch {
setErrorMessage(GENERIC_ERROR);
Expand Down Expand Up @@ -147,7 +153,9 @@ export function GoogleSignin() {
aria-hidden
className={cn(
"absolute inset-0 z-10 overflow-hidden opacity-0",
!isReady || isSubmitting ? "pointer-events-none" : "pointer-events-auto",
!isReady || isSubmitting
? "pointer-events-none"
: "pointer-events-auto",
)}
/>
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/admin/src/components/auth/otp-signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { usePathname } from "next/navigation";
import { useEffect, useRef, useState } from "react";

const GENERIC_ERROR = "Unable to sign in. Please contact your administrator.";
const RATE_LIMITED_ERROR = "Too many attempts. Please wait a moment and try again.";
const RATE_LIMITED_ERROR =
"Too many attempts. Please wait a moment and try again.";

type Props = {
className?: string;
Expand Down
Loading
Loading