-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[WEB-4542] feat: god mode auth revamp and code refactor #7563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sriramveeraghanta
merged 3 commits into
preview
from
feat-god-mode-auth-revamp-and-code-refactor
Aug 11, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| "use client"; | ||
|
|
||
| import Link from "next/link"; | ||
| import { PlaneLockup } from "@plane/ui"; | ||
|
|
||
| export const AuthHeader = () => ( | ||
| <div className="flex items-center justify-between gap-6 w-full flex-shrink-0 sticky top-0"> | ||
| <Link href="/"> | ||
| <PlaneLockup height={20} width={95} className="text-custom-text-100" /> | ||
| </Link> | ||
| </div> | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,9 @@ | ||
| "use client"; | ||
|
|
||
| import Image from "next/image"; | ||
| import Link from "next/link"; | ||
| import { useTheme } from "next-themes"; | ||
| // logo assets | ||
| import PlaneBackgroundPatternDark from "public/auth/background-pattern-dark.svg"; | ||
| import PlaneBackgroundPattern from "public/auth/background-pattern.svg"; | ||
| import BlackHorizontalLogo from "public/plane-logos/black-horizontal-with-blue-logo.png"; | ||
| import WhiteHorizontalLogo from "public/plane-logos/white-horizontal-with-blue-logo.png"; | ||
|
|
||
| export default function RootLayout({ children }: { children: React.ReactNode }) { | ||
| const { resolvedTheme } = useTheme(); | ||
|
|
||
| const patternBackground = resolvedTheme === "light" ? PlaneBackgroundPattern : PlaneBackgroundPatternDark; | ||
| const logo = resolvedTheme === "light" ? BlackHorizontalLogo : WhiteHorizontalLogo; | ||
|
|
||
| return ( | ||
| <div className="relative"> | ||
| <div className="h-screen w-full overflow-hidden overflow-y-auto flex flex-col"> | ||
| <div className="container h-[110px] flex-shrink-0 mx-auto px-5 lg:px-0 flex items-center justify-between gap-5 z-50"> | ||
| <div className="flex items-center gap-x-2 py-10"> | ||
| <Link href={`/`} className="h-[30px] w-[133px]"> | ||
| <Image src={logo} alt="Plane logo" /> | ||
| </Link> | ||
| </div> | ||
| </div> | ||
| <div className="absolute inset-0 z-0"> | ||
| <Image src={patternBackground} className="w-screen h-full object-cover" alt="Plane background pattern" /> | ||
| </div> | ||
| <div className="relative z-10 flex-grow">{children}</div> | ||
| </div> | ||
| <div className="relative z-10 flex flex-col items-center w-screen h-screen overflow-hidden overflow-y-auto pt-6 pb-10 px-8"> | ||
| {children} | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,9 @@ import { Button, Input, Spinner } from "@plane/ui"; | |
| // components | ||
| import { Banner } from "@/components/common/banner"; | ||
| // local components | ||
| import { FormHeader } from "../../../core/components/instance/form-header"; | ||
| import { AuthBanner } from "./auth-banner"; | ||
| import { AuthHeader } from "./auth-header"; | ||
| import { authErrorHandler } from "./auth-helpers"; | ||
|
|
||
| // service initialization | ||
|
|
@@ -101,78 +103,91 @@ export const InstanceSignInForm: FC = () => { | |
| }, [errorCode]); | ||
|
|
||
| return ( | ||
| <form | ||
| className="space-y-4" | ||
| method="POST" | ||
| action={`${API_BASE_URL}/api/instances/admins/sign-in/`} | ||
| onSubmit={() => setIsSubmitting(true)} | ||
| onError={() => setIsSubmitting(false)} | ||
| > | ||
| {errorData.type && errorData?.message ? ( | ||
| <Banner type="error" message={errorData?.message} /> | ||
| ) : ( | ||
| <>{errorInfo && <AuthBanner bannerData={errorInfo} handleBannerData={(value) => setErrorInfo(value)} />}</> | ||
| )} | ||
| <input type="hidden" name="csrfmiddlewaretoken" value={csrfToken} /> | ||
|
|
||
| <div className="w-full space-y-1"> | ||
| <label className="text-sm text-onboarding-text-300 font-medium" htmlFor="email"> | ||
| Email <span className="text-red-500">*</span> | ||
| </label> | ||
| <Input | ||
| className="w-full border border-onboarding-border-100 !bg-onboarding-background-200 placeholder:text-onboarding-text-400" | ||
| id="email" | ||
| name="email" | ||
| type="email" | ||
| inputSize="md" | ||
| placeholder="[email protected]" | ||
| value={formData.email} | ||
| onChange={(e) => handleFormChange("email", e.target.value)} | ||
| autoComplete="on" | ||
| autoFocus | ||
| /> | ||
| </div> | ||
|
|
||
| <div className="w-full space-y-1"> | ||
| <label className="text-sm text-onboarding-text-300 font-medium" htmlFor="password"> | ||
| Password <span className="text-red-500">*</span> | ||
| </label> | ||
| <div className="relative"> | ||
| <Input | ||
| className="w-full border border-onboarding-border-100 !bg-onboarding-background-200 placeholder:text-onboarding-text-400" | ||
| id="password" | ||
| name="password" | ||
| type={showPassword ? "text" : "password"} | ||
| inputSize="md" | ||
| placeholder="Enter your password" | ||
| value={formData.password} | ||
| onChange={(e) => handleFormChange("password", e.target.value)} | ||
| autoComplete="on" | ||
| <> | ||
| <AuthHeader /> | ||
| <div className="flex flex-col justify-center items-center flex-grow w-full py-6 mt-10"> | ||
| <div className="relative flex flex-col gap-6 max-w-[22.5rem] w-full"> | ||
| <FormHeader | ||
| heading="Manage your Plane instance" | ||
| subHeading="Configure instance-wide settings to secure your instance" | ||
| /> | ||
| {showPassword ? ( | ||
| <button | ||
| type="button" | ||
| className="absolute right-3 top-3.5 flex items-center justify-center text-custom-text-400" | ||
| onClick={() => setShowPassword(false)} | ||
| > | ||
| <EyeOff className="h-4 w-4" /> | ||
| </button> | ||
| ) : ( | ||
| <button | ||
| type="button" | ||
| className="absolute right-3 top-3.5 flex items-center justify-center text-custom-text-400" | ||
| onClick={() => setShowPassword(true)} | ||
| > | ||
| <Eye className="h-4 w-4" /> | ||
| </button> | ||
| )} | ||
| <form | ||
| className="space-y-4" | ||
| method="POST" | ||
| action={`${API_BASE_URL}/api/instances/admins/sign-in/`} | ||
| onSubmit={() => setIsSubmitting(true)} | ||
| onError={() => setIsSubmitting(false)} | ||
| > | ||
| {errorData.type && errorData?.message ? ( | ||
| <Banner type="error" message={errorData?.message} /> | ||
| ) : ( | ||
| <> | ||
| {errorInfo && <AuthBanner bannerData={errorInfo} handleBannerData={(value) => setErrorInfo(value)} />} | ||
| </> | ||
| )} | ||
| <input type="hidden" name="csrfmiddlewaretoken" value={csrfToken} /> | ||
|
|
||
| <div className="w-full space-y-1"> | ||
| <label className="text-sm text-custom-text-300 font-medium" htmlFor="email"> | ||
| Email <span className="text-red-500">*</span> | ||
| </label> | ||
| <Input | ||
| className="w-full border border-custom-border-100 !bg-custom-background-100 placeholder:text-custom-text-400" | ||
| id="email" | ||
| name="email" | ||
| type="email" | ||
| inputSize="md" | ||
| placeholder="[email protected]" | ||
| value={formData.email} | ||
| onChange={(e) => handleFormChange("email", e.target.value)} | ||
| autoComplete="on" | ||
| autoFocus | ||
| /> | ||
| </div> | ||
|
|
||
| <div className="w-full space-y-1"> | ||
| <label className="text-sm text-custom-text-300 font-medium" htmlFor="password"> | ||
| Password <span className="text-red-500">*</span> | ||
| </label> | ||
| <div className="relative"> | ||
| <Input | ||
| className="w-full border border-custom-border-100 !bg-custom-background-100 placeholder:text-custom-text-400" | ||
| id="password" | ||
| name="password" | ||
| type={showPassword ? "text" : "password"} | ||
| inputSize="md" | ||
| placeholder="Enter your password" | ||
| value={formData.password} | ||
| onChange={(e) => handleFormChange("password", e.target.value)} | ||
| autoComplete="on" | ||
| /> | ||
| {showPassword ? ( | ||
| <button | ||
| type="button" | ||
| className="absolute right-3 top-3.5 flex items-center justify-center text-custom-text-400" | ||
| onClick={() => setShowPassword(false)} | ||
| > | ||
| <EyeOff className="h-4 w-4" /> | ||
| </button> | ||
| ) : ( | ||
| <button | ||
| type="button" | ||
| className="absolute right-3 top-3.5 flex items-center justify-center text-custom-text-400" | ||
| onClick={() => setShowPassword(true)} | ||
| > | ||
| <Eye className="h-4 w-4" /> | ||
| </button> | ||
| )} | ||
| </div> | ||
| </div> | ||
| <div className="py-2"> | ||
| <Button type="submit" size="lg" className="w-full" disabled={isButtonDisabled}> | ||
| {isSubmitting ? <Spinner height="20px" width="20px" /> : "Sign in"} | ||
| </Button> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| <div className="py-2"> | ||
| <Button type="submit" size="lg" className="w-full" disabled={isButtonDisabled}> | ||
| {isSubmitting ? <Spinner height="20px" width="20px" /> : "Sign in"} | ||
| </Button> | ||
| </div> | ||
| </form> | ||
| </> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| "use client"; | ||
|
|
||
| export const FormHeader = ({ heading, subHeading }: { heading: string; subHeading: string }) => ( | ||
| <div className="flex flex-col gap-1"> | ||
| <span className="text-2xl font-semibold text-custom-text-100 leading-7">{heading}</span> | ||
| <span className="text-lg font-semibold text-custom-text-400 leading-7">{subHeading}</span> | ||
| </div> | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.