Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

UI improvements for password flow

Steven Tey4b4f7ffeaf4a
diff --git a/apps/web/app/app.dub.co/(auth)/auth/reset-password/[token]/form.tsx b/apps/web/app/app.dub.co/(auth)/auth/reset-password/[token]/form.tsx
index 332f3883d2..71ab0a3bf7 100644
--- a/apps/web/app/app.dub.co/(auth)/auth/reset-password/[token]/form.tsx
+++ b/apps/web/app/app.dub.co/(auth)/auth/reset-password/[token]/form.tsx
@@ -51,12 +51,7 @@ export const ResetPasswordForm = () => {
<div className="grid w-full max-w-sm items-center gap-2">
<Label htmlFor="password">Password</Label>
- <Input
- type="password"
- placeholder="********"
- {...register("password")}
- required
- />
+ <Input type="password" {...register("password")} required />
{errors.password && (
<span
className="block text-sm text-red-500"
@@ -70,12 +65,7 @@ export const ResetPasswordForm = () => {
<div className="grid w-full max-w-sm items-center gap-2">
<Label htmlFor="confirmPassword">Confirm Password</Label>
- <Input
- type="password"
- placeholder="********"
- {...register("confirmPassword")}
- required
- />
+ <Input type="password" {...register("confirmPassword")} required />
{errors.confirmPassword && (
<span
className="block text-sm text-red-500"
diff --git a/apps/web/app/app.dub.co/(auth)/login/signin-email-password.tsx b/apps/web/app/app.dub.co/(auth)/login/signin-email-password.tsx
index 4b938bc101..ecd543e8b9 100644
--- a/apps/web/app/app.dub.co/(auth)/login/signin-email-password.tsx
+++ b/apps/web/app/app.dub.co/(auth)/login/signin-email-password.tsx
@@ -13,7 +13,6 @@ import { signIn } from "next-auth/react";
import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
-import { toast } from "sonner";
const errorCodes = {
"no-credentials": "Please provide an email and password.",
@@ -62,7 +61,6 @@ export const SignInWithEmailPassword = () => {
if (response.url) {
setLastUsedAuthMethod("password");
- toast.success("Redirecting...");
router.replace(response.url);
return;
}
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/security/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/security/page-client.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/settings/security/page-client.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/security/page-client.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/security/page.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/security/page.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/settings/security/page.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/security/page.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/security/request-set-password.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/security/request-set-password.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/settings/security/request-set-password.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/security/request-set-password.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/security/update-password.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/security/update-password.tsx
similarity index 73%
rename from apps/web/app/app.dub.co/(dashboard)/settings/security/update-password.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/security/update-password.tsx
index e8b120c6d3..a64a614345 100644
--- a/apps/web/app/app.dub.co/(dashboard)/settings/security/update-password.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/account/settings/security/update-password.tsx
@@ -3,6 +3,7 @@
import z from "@/lib/zod";
import { updatePasswordSchema } from "@/lib/zod/schemas/auth";
import { Button, Input, Label } from "@dub/ui";
+import { Tooltip } from "@dub/ui/src/tooltip";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
@@ -47,30 +48,22 @@ export const UpdatePassword = () => {
className="rounded-lg border border-gray-200 bg-white"
onSubmit={onSubmit}
>
- <div className="flex flex-col space-y-3 p-5 sm:p-10">
- <h2 className="text-xl font-medium">Password</h2>
- <p className="pb-2 text-sm text-gray-500">
- Manage your account password on {process.env.NEXT_PUBLIC_APP_NAME}.
- </p>
- <div className="flex flex-wrap justify-between space-y-4 sm:space-x-4 sm:space-y-0">
+ <div>
+ <div className="flex flex-col gap-3 border-b border-gray-200 p-5 sm:p-10">
+ <h2 className="text-xl font-medium">Password</h2>
+ <p className="pb-2 text-sm text-gray-500">
+ Manage your account password on {process.env.NEXT_PUBLIC_APP_NAME}.
+ </p>
+ </div>
+ <div className="flex flex-wrap justify-between gap-y-4 p-5 sm:gap-x-4 sm:gap-y-0 sm:p-10">
<div className="grid w-full max-w-sm items-center gap-2">
<Label htmlFor="currentPassword">Current Password</Label>
- <Input
- type="password"
- placeholder="********"
- {...register("currentPassword")}
- required
- />
+ <Input type="password" {...register("currentPassword")} required />
</div>
<div className="grid w-full max-w-sm items-center gap-2">
<Label htmlFor="newPassword">New Password</Label>
- <Input
- type="password"
- placeholder="********"
- {...register("newPassword")}
- required
- />
+ <Input type="password" {...register("newPassword")} required />
</div>
</div>
@@ -98,10 +91,11 @@ export const UpdatePassword = () => {
</div>
<div className="flex items-center justify-between space-x-4 rounded-b-lg border-t border-gray-200 bg-gray-50 p-3 sm:px-10">
- <p className="text-sm text-gray-500">
- Passwords must be at least 8 characters long containing at least one
- number, one uppercase, and one lowercase letter.
- </p>
+ <Tooltip content="Passwords must be at least 8 characters long containing at least one number, one uppercase, and one lowercase letter.">
+ <p className="text-sm text-gray-500 underline decoration-dotted underline-offset-2 hover:text-gray-700">
+ Password requirements
+ </p>
+ </Tooltip>
<div className="shrink-0">
<Button
text="Update Password"
diff --git a/packages/ui/src/input.tsx b/packages/ui/src/input.tsx
index 2b1c2adbb8..549e6a6202 100644
--- a/packages/ui/src/input.tsx
+++ b/packages/ui/src/input.tsx
@@ -36,12 +36,15 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
aria-label={isPasswordVisible ? "Hide password" : "Show Password"}
>
{isPasswordVisible ? (
- <EyeOffIcon
- className="h-5 w-5 flex-none transition"
+ <EyeIcon
+ className="h-5 w-5 flex-none text-gray-500 transition hover:text-gray-700"
aria-hidden
/>
) : (
- <EyeIcon className="h-5 w-5 flex-none transition" aria-hidden />
+ <EyeOffIcon
+ className="h-5 w-5 flex-none text-gray-500 transition hover:text-gray-700"
+ aria-hidden
+ />
)}
</button>
)}