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.

Update login page

Tim Wilsona383c11877ff
diff --git a/apps/web/app/app.dub.co/(auth)/login/page.tsx b/apps/web/app/app.dub.co/(auth)/login/page.tsx
index a7dac76f57..ddef6ee3fc 100644
--- a/apps/web/app/app.dub.co/(auth)/login/page.tsx
+++ b/apps/web/app/app.dub.co/(auth)/login/page.tsx
@@ -11,19 +11,19 @@ export const metadata = constructMetadata({
export default function LoginPage() {
return (
<AuthLayout>
- <div className="w-full max-w-md overflow-hidden border-y border-neutral-200 sm:rounded-2xl sm:border sm:shadow-sm">
- <div className="border-b border-neutral-200 bg-white pb-6 pt-8 text-center">
- <h3 className="text-lg font-semibold">Sign in to your Dub account</h3>
- </div>
- <div className="bg-neutral-50 px-4 py-8 sm:px-16">
+ <div className="w-full max-w-sm">
+ <h3 className="text-center text-xl font-semibold">
+ Log in to your Dub account
+ </h3>
+ <div className="mt-8">
<LoginForm />
</div>
</div>
- <p className="mt-4 text-center text-sm text-neutral-500">
+ <p className="mt-6 text-center text-sm font-medium text-neutral-500">
Don't have an account?&nbsp;
<Link
href="register"
- className="font-semibold text-neutral-500 underline underline-offset-2 transition-colors hover:text-black"
+ className="font-semibold text-neutral-700 transition-colors hover:text-neutral-900"
>
Sign up
</Link>
diff --git a/apps/web/app/app.dub.co/(auth)/register/page-client.tsx b/apps/web/app/app.dub.co/(auth)/register/page-client.tsx
index 61ea4dec4f..ced8449870 100644
--- a/apps/web/app/app.dub.co/(auth)/register/page-client.tsx
+++ b/apps/web/app/app.dub.co/(auth)/register/page-client.tsx
@@ -28,13 +28,13 @@ function SignUp() {
<SignUpForm />
</div>
</div>
- <p className="mt-4 text-center text-sm text-neutral-500">
+ <p className="mt-6 text-center text-sm font-medium text-neutral-500">
Already have an account?&nbsp;
<Link
href="/login"
- className="font-semibold text-neutral-500 underline underline-offset-2 transition-colors hover:text-black"
+ className="font-semibold text-neutral-700 transition-colors hover:text-neutral-900"
>
- Sign in
+ Log in
</Link>
</p>
</>
diff --git a/apps/web/ui/auth/auth-methods-separator.tsx b/apps/web/ui/auth/auth-methods-separator.tsx
new file mode 100644
index 0000000000..b9957e0dc7
--- /dev/null
+++ b/apps/web/ui/auth/auth-methods-separator.tsx
@@ -0,0 +1,11 @@
+export function AuthMethodsSeparator() {
+ return (
+ <div className="my-3 flex flex-shrink items-center justify-center gap-2">
+ <div className="grow basis-0 border-b border-neutral-200" />
+ <span className="text-content-muted text-xs font-medium uppercase leading-none">
+ or
+ </span>
+ <div className="grow basis-0 border-b border-neutral-200" />
+ </div>
+ );
+}
diff --git a/apps/web/ui/auth/login/email-sign-in.tsx b/apps/web/ui/auth/login/email-sign-in.tsx
index 3fc2af22f9..d688888029 100644
--- a/apps/web/ui/auth/login/email-sign-in.tsx
+++ b/apps/web/ui/auth/login/email-sign-in.tsx
@@ -1,8 +1,6 @@
import { checkAccountExistsAction } from "@/lib/actions/check-account-exists";
import { Button, Input, useMediaQuery } from "@dub/ui";
-import { InputPassword } from "@dub/ui/icons";
import { cn } from "@dub/utils";
-import { Mail } from "lucide-react";
import { signIn } from "next-auth/react";
import { useAction } from "next-safe-action/hooks";
import Link from "next/link";
@@ -117,31 +115,47 @@ export const EmailSignIn = ({ next }: { next?: string }) => {
router.push(response?.url || finalNext || "/workspaces");
}
}}
- className="flex flex-col gap-y-3"
+ className="flex flex-col gap-y-6"
>
{authMethod === "email" && (
- <input
- id="email"
- name="email"
- autoFocus={!isMobile && !showPasswordField}
- type="email"
- placeholder="[email protected]"
- autoComplete="email"
- required
- value={email}
- onChange={(e) => setEmail(e.target.value)}
- size={1}
- className={cn(
- "block w-full min-w-0 appearance-none rounded-md border border-neutral-300 px-3 py-2 placeholder-neutral-400 shadow-sm focus:border-black focus:outline-none focus:ring-black sm:text-sm",
- {
- "pr-10": isPending,
- },
- )}
- />
+ <label>
+ <span className="text-content-emphasis mb-2 block text-sm font-medium leading-none">
+ Email
+ </span>
+ <input
+ id="email"
+ name="email"
+ autoFocus={!isMobile && !showPasswordField}
+ type="email"
+ placeholder="[email protected]"
+ autoComplete="email"
+ required
+ value={email}
+ onChange={(e) => setEmail(e.target.value)}
+ size={1}
+ className={cn(
+ "block w-full min-w-0 appearance-none rounded-md border border-neutral-300 px-3 py-2 placeholder-neutral-400 shadow-sm focus:border-black focus:outline-none focus:ring-black sm:text-sm",
+ {
+ "pr-10": isPending,
+ },
+ )}
+ />
+ </label>
)}
{showPasswordField && (
- <div>
+ <label>
+ <div className="mb-2 flex items-center justify-between">
+ <span className="text-content-emphasis block text-sm font-medium leading-none">
+ Password
+ </span>
+ <Link
+ href={`/forgot-password?email=${encodeURIComponent(email)}`}
+ className="text-content-subtle hover:text-content-emphasis text-xs leading-none underline underline-offset-2 transition-colors"
+ >
+ Forgot password?
+ </Link>
+ </div>
<Input
type="password"
autoFocus={!isMobile}
@@ -149,19 +163,11 @@ export const EmailSignIn = ({ next }: { next?: string }) => {
placeholder="Password (optional)"
onChange={(e) => setPassword(e.target.value)}
/>
- </div>
+ </label>
)}
<Button
- text={`Continue with ${password ? "Password" : "Email"}`}
- variant="secondary"
- icon={
- password ? (
- <InputPassword className="size-4 text-neutral-600" />
- ) : (
- <Mail className="size-4 text-neutral-600" />
- )
- }
+ text={`Log in with ${password ? "password" : "email"}`}
{...(authMethod !== "email" && {
type: "button",
onClick: (e) => {
@@ -174,14 +180,6 @@ export const EmailSignIn = ({ next }: { next?: string }) => {
disabled={clickedMethod && clickedMethod !== "email"}
/>
</form>
- {showPasswordField && (
- <Link
- href={`/forgot-password?email=${encodeURIComponent(email)}`}
- className="text-center text-xs text-neutral-500 transition-colors hover:text-black"
- >
- Forgot password?
- </Link>
- )}
</>
);
};
diff --git a/apps/web/ui/auth/login/login-form.tsx b/apps/web/ui/auth/login/login-form.tsx
index aed205dc8b..dfbe0399e0 100644
--- a/apps/web/ui/auth/login/login-form.tsx
+++ b/apps/web/ui/auth/login/login-form.tsx
@@ -1,6 +1,6 @@
"use client";
-import { AnimatedSizeContainer, useLocalStorage } from "@dub/ui";
+import { AnimatedSizeContainer, Button, useLocalStorage } from "@dub/ui";
import { useSearchParams } from "next/navigation";
import {
ComponentType,
@@ -12,6 +12,7 @@ import {
useState,
} from "react";
import { toast } from "sonner";
+import { AuthMethodsSeparator } from "../auth-methods-separator";
import { EmailSignIn } from "./email-sign-in";
import { GitHubButton } from "./github-button";
import { GoogleButton } from "./google-button";
@@ -155,7 +156,7 @@ export default function LoginForm({
<AnimatedSizeContainer height>
<div className="flex flex-col gap-3 p-1">
{authMethod && (
- <div className="flex flex-col gap-2">
+ <div className="flex flex-col gap-3">
{AuthMethodComponent && (
<AuthMethodComponent {...currentAuthProvider?.props} />
)}
@@ -171,25 +172,17 @@ export default function LoginForm({
</span>
</div>
)}
- <div className="my-2 flex flex-shrink items-center justify-center gap-2">
- <div className="grow basis-0 border-b border-neutral-300" />
- <span className="text-xs font-normal uppercase leading-none text-neutral-500">
- or
- </span>
- <div className="grow basis-0 border-b border-neutral-300" />
- </div>
+ <AuthMethodsSeparator />
</div>
)}
{showEmailPasswordOnly ? (
- <div className="mt-2 text-center text-sm text-neutral-500">
- <button
- type="button"
+ <div className="mt-2">
+ <Button
+ variant="secondary"
onClick={() => setShowPasswordField(false)}
- className="font-semibold text-neutral-500 transition-colors hover:text-black"
- >
- Continue with another method
- </button>
+ text="Continue with another method"
+ />
</div>
) : (
authProviders
diff --git a/apps/web/ui/auth/register/signup-form.tsx b/apps/web/ui/auth/register/signup-form.tsx
index a01185f5c8..199ffea90d 100644
--- a/apps/web/ui/auth/register/signup-form.tsx
+++ b/apps/web/ui/auth/register/signup-form.tsx
@@ -1,5 +1,6 @@
"use client";
+import { AuthMethodsSeparator } from "../auth-methods-separator";
import { SignUpEmail } from "./signup-email";
import { SignUpOAuth } from "./signup-oauth";
@@ -11,15 +12,7 @@ export const SignUpForm = ({
return (
<div className="flex flex-col gap-3">
{methods.includes("email") && <SignUpEmail />}
- {methods.length && (
- <div className="my-2 flex flex-shrink items-center justify-center gap-2">
- <div className="grow basis-0 border-b border-neutral-300" />
- <span className="text-xs font-normal uppercase leading-none text-neutral-500">
- or
- </span>
- <div className="grow basis-0 border-b border-neutral-300" />
- </div>
- )}
+ {methods.length && <AuthMethodsSeparator />}
<SignUpOAuth methods={methods} />
</div>
);