Skip to content

Open-source status page, incident response and uptime monitoring

chore: improve protected page (#800)

Maximilian Kaske33cb28b270f8
diff --git a/apps/web/public/assets/changelog/password-protected-status-page.png b/apps/web/public/assets/changelog/password-protected-status-page.png
index d6fa85af1..47fdf5db3 100644
Binary files a/apps/web/public/assets/changelog/password-protected-status-page.png and b/apps/web/public/assets/changelog/password-protected-status-page.png differ
diff --git a/apps/web/src/app/status-page/[domain]/_components/password-form.tsx b/apps/web/src/app/status-page/[domain]/_components/password-form.tsx
index 3be8b2030..481f75c00 100644
--- a/apps/web/src/app/status-page/[domain]/_components/password-form.tsx
+++ b/apps/web/src/app/status-page/[domain]/_components/password-form.tsx
@@ -3,6 +3,7 @@
import { useEffect, useState, useTransition } from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { zodResolver } from "@hookform/resolvers/zod";
+import { Eye, EyeOff } from "lucide-react";
import { useForm } from "react-hook-form";
import { z } from "zod";
@@ -10,12 +11,11 @@ import {
Button,
Form,
FormControl,
- FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
- Input,
+ InputWithAddons,
} from "@openstatus/ui";
import { LoadingAnimation } from "@/components/loading-animation";
@@ -40,6 +40,7 @@ export function PasswordForm({ slug }: { slug: string }) {
defaultValues: { password: "" },
});
const [loading, setLoading] = useState(true);
+ const [inputType, setInputType] = useState<"password" | "text">("password");
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
@@ -94,16 +95,28 @@ export function PasswordForm({ slug }: { slug: string }) {
<FormItem>
<FormLabel>Password</FormLabel>
<FormControl>
- <Input
+ <InputWithAddons
placeholder="top-secret"
- type="password"
+ type={inputType}
disabled={loading}
+ trailing={
+ <button
+ onClick={() =>
+ setInputType((type) =>
+ type === "password" ? "text" : "password",
+ )
+ }
+ >
+ {inputType === "password" ? (
+ <Eye className="h-5 w-5" />
+ ) : (
+ <EyeOff className="h-5 w-5" />
+ )}
+ </button>
+ }
{...field}
/>
</FormControl>
- <FormDescription>
- Enter the password to access the status page.
- </FormDescription>
<FormMessage />
</FormItem>
)}
diff --git a/apps/web/src/app/status-page/[domain]/_components/password-protected.tsx b/apps/web/src/app/status-page/[domain]/_components/password-protected.tsx
index 09ebd506e..7c0224c50 100644
--- a/apps/web/src/app/status-page/[domain]/_components/password-protected.tsx
+++ b/apps/web/src/app/status-page/[domain]/_components/password-protected.tsx
@@ -14,9 +14,16 @@ export default function PasswordProtected({
return (
<div className="mx-auto flex min-h-screen w-full max-w-3xl flex-col space-y-6 p-4 md:p-8">
<main className="flex h-full w-full flex-1 flex-col justify-center">
- <Shell className="mx-auto grid gap-6">
- <h1 className="text-2xl font-semibold">Protected Page</h1>
- <PasswordForm slug={slug} />
+ <Shell className="mx-auto grid max-w-xl gap-6">
+ <div className="flex flex-col gap-2">
+ <h1 className="text-center text-3xl font-semibold tracking-tight">
+ Protected Page
+ </h1>
+ <p className="text-muted-foreground text-center text-sm">
+ Enter the password to access the status page.
+ </p>
+ <PasswordForm slug={slug} />
+ </div>
</Shell>
</main>
<Footer plan={plan} />
diff --git a/apps/web/src/content/changelog/password-protected-status-page.mdx b/apps/web/src/content/changelog/password-protected-status-page.mdx
index dc97e2c70..100a416e5 100644
--- a/apps/web/src/content/changelog/password-protected-status-page.mdx
+++ b/apps/web/src/content/changelog/password-protected-status-page.mdx
@@ -8,6 +8,12 @@ publishedAt: 2024-05-03
You can now protect your status page with a password. This will hide the page
from the public and only allow access to users with the password.
-You can enable the password protection from the status page settings.
+You can enable the password protection from the status page within the
+_Visibility_ settings. You will be able to:
+
+- Enable the feature with a simple checkbox to easily turn it on and off
+- Set your password
+- Share the protected page with a `?authorize=your-password` query parameter to
+ auto-complete the password field
> This feature is available on the Starter plan and above.