forked from danswer-ai/danswer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82ef572
commit 957508d
Showing
13 changed files
with
486 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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,88 @@ | ||
import { HealthCheckBanner } from "@/components/health/healthcheck"; | ||
import { User } from "@/lib/types"; | ||
import { | ||
getCurrentUserSS, | ||
getAuthTypeMetadataSS, | ||
AuthTypeMetadata, | ||
} from "@/lib/userSS"; | ||
import { redirect } from "next/navigation"; | ||
import Link from "next/link"; | ||
|
||
import Logo from "../../../../public/logo-brand.png"; | ||
import Image from "next/image"; | ||
import { Button } from "@/components/ui/button"; | ||
import DefaultUserChart from "../../../../public/default-user-chart.png"; | ||
import LoginImage from "../../../../public/LoginImage.png"; | ||
import GmailIcon from "../../../../public/Gmail.png"; | ||
import MicrosoftIcon from "../../../../public/microsoft.svg"; | ||
import { Separator } from "@/components/ui/separator"; | ||
import { SignupForms } from "../signup/SignupForms"; | ||
import { Fingerprint } from "lucide-react"; | ||
import { TextFormField } from "@/components/admin/connectors/Field"; | ||
import { Form, Formik } from "formik"; | ||
import { Progress } from "@/components/ui/progress"; | ||
import { EnterEmail } from "./steps/enterEmail"; | ||
import { EnterVerification } from "./steps/EmailVerification"; | ||
import { SetNewPassword } from "./steps/SetNewPassword"; | ||
import { SuccessChangePassword } from "./steps/Done"; | ||
|
||
const Page = async () => { | ||
// catch cases where the backend is completely unreachable here | ||
// without try / catch, will just raise an exception and the page | ||
// will not render | ||
let authTypeMetadata: AuthTypeMetadata | null = null; | ||
let currentUser: User | null = null; | ||
try { | ||
[authTypeMetadata, currentUser] = await Promise.all([ | ||
getAuthTypeMetadataSS(), | ||
getCurrentUserSS(), | ||
]); | ||
} catch (e) { | ||
console.log(`Some fetch failed for the login page - ${e}`); | ||
} | ||
|
||
// simply take the user to the home page if Auth is disabled | ||
if (authTypeMetadata?.authType === "disabled") { | ||
return redirect("/"); | ||
} | ||
|
||
// if user is already logged in, take them to the main app page | ||
if (currentUser && currentUser.is_active) { | ||
if (!authTypeMetadata?.requiresVerification || currentUser.is_verified) { | ||
return redirect("/"); | ||
} | ||
return redirect("/auth/waiting-on-verification"); | ||
} | ||
|
||
// only enable this page if basic login is enabled | ||
if (authTypeMetadata?.authType !== "basic") { | ||
return redirect("/"); | ||
} | ||
|
||
return ( | ||
<main className="relative h-full"> | ||
<HealthCheckBanner /> | ||
<div className="absolute top-6 left-10"> | ||
<Image src={Logo} alt="Logo" className="w-28 xl:w-32" /> | ||
</div> | ||
|
||
<div className="flex justify-center items-center h-full"> | ||
<div className="w-[500px]"> | ||
<EnterEmail /> | ||
{/* <EnterVerification /> */} | ||
{/* <SetNewPassword /> */} | ||
{/* <SuccessChangePassword /> */} | ||
</div> | ||
</div> | ||
|
||
<div className="w-[500px] flex gap-2 absolute bottom-10 left-1/2 -translate-x-1/2"> | ||
<Progress value={100} /> | ||
<Progress value={0} /> | ||
<Progress value={0} /> | ||
<Progress value={0} /> | ||
</div> | ||
</main> | ||
); | ||
}; | ||
|
||
export default Page; |
This file contains 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,34 @@ | ||
"use client"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { PartyPopper } from "lucide-react"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
|
||
export const SuccessChangePassword = () => { | ||
return ( | ||
<div className="w-full"> | ||
<div className="flex items-center justify-center"> | ||
<div className="bg-primary p-5 rounded-md"> | ||
<PartyPopper size={40} stroke="white" /> | ||
</div> | ||
</div> | ||
|
||
<div className="pt-8 text-sm text-subtle"> | ||
<h1 className="text-2xl xl:text-3xl font-bold text-center text-dark-900"> | ||
All done! | ||
</h1> | ||
<p className="text-center pt-2"> | ||
Your password has been successfully reset. | ||
</p> | ||
<p className="text-center">Click below to log in.</p> | ||
</div> | ||
|
||
<Link href="/auth/login"> | ||
<Button type="submit" className="w-full mt-6"> | ||
Continue | ||
</Button> | ||
</Link> | ||
</div> | ||
); | ||
}; |
70 changes: 70 additions & 0 deletions
70
web/src/app/auth/forgot-password/steps/EmailVerification.tsx
This file contains 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,70 @@ | ||
"use client"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { | ||
InputOTP, | ||
InputOTPGroup, | ||
InputOTPSeparator, | ||
InputOTPSlot, | ||
} from "@/components/ui/input-otp"; | ||
import { MailOpen } from "lucide-react"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
|
||
export const EnterVerification = () => { | ||
return ( | ||
<div className="w-full"> | ||
<div className="flex items-center justify-center"> | ||
<div className="bg-primary p-5 rounded-md"> | ||
<MailOpen size={40} stroke="white" /> | ||
</div> | ||
</div> | ||
|
||
<div className="pt-8"> | ||
<h1 className="text-2xl xl:text-3xl font-bold text-center text-dark-900"> | ||
Email Verification | ||
</h1> | ||
<p className="text-center pt-2 text-sm text-subtle"> | ||
We sent a code to johnnydoe@gmail.com | ||
</p> | ||
</div> | ||
|
||
<div className="pt-8 flex items-center flex-col gap-8 justify-center"> | ||
<InputOTP maxLength={6}> | ||
<InputOTPGroup> | ||
<InputOTPSlot index={0} className="h-16 w-16 text-3xl font-bold" /> | ||
<InputOTPSlot index={1} className="h-16 w-16 text-3xl font-bold" /> | ||
<InputOTPSlot index={2} className="h-16 w-16 text-3xl font-bold" /> | ||
</InputOTPGroup> | ||
<InputOTPSeparator /> | ||
<InputOTPGroup> | ||
<InputOTPSlot index={3} className="h-16 w-16 text-3xl font-bold" /> | ||
<InputOTPSlot index={4} className="h-16 w-16 text-3xl font-bold" /> | ||
<InputOTPSlot index={5} className="h-16 w-16 text-3xl font-bold" /> | ||
</InputOTPGroup> | ||
</InputOTP> | ||
|
||
<Button className="w-full">Continue</Button> | ||
|
||
<p className="text-center text-sm"> | ||
Didn’t receive the email?{" "} | ||
<Link | ||
href="" | ||
className="text-sm font-medium text-link hover:underline" | ||
> | ||
Click to resend | ||
</Link> | ||
</p> | ||
</div> | ||
|
||
<div className="flex pt-6"> | ||
<Link | ||
href="/auth/login" | ||
className="text-sm font-medium text-link hover:underline mx-auto" | ||
> | ||
Back to Sign In | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains 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,54 @@ | ||
"use client"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Label } from "@/components/ui/label"; | ||
import { Fingerprint } from "lucide-react"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
|
||
export const EnterEmail = () => { | ||
return ( | ||
<div className="w-full"> | ||
<div className="flex items-center justify-center"> | ||
<div className="bg-primary p-5 rounded-md"> | ||
<Fingerprint size={40} stroke="white" /> | ||
</div> | ||
</div> | ||
|
||
<div className="pt-8"> | ||
<h1 className="text-2xl xl:text-3xl font-bold text-center text-dark-900"> | ||
Forgot Password? | ||
</h1> | ||
<p className="pt-2 text-center text-sm text-subtle"> | ||
Enter your email to reset your password | ||
</p> | ||
</div> | ||
|
||
<form className="w-full pt-8"> | ||
<div> | ||
<Label htmlFor="email">Email</Label> | ||
<Input | ||
id="email" | ||
name="email" | ||
type="email" | ||
placeholder="Enter your email" | ||
/> | ||
</div> | ||
|
||
<Button type="submit" className="w-full mt-6"> | ||
Continue | ||
</Button> | ||
</form> | ||
|
||
<div className="flex pt-6"> | ||
<Link | ||
href="/auth/login" | ||
className="text-sm font-medium text-link hover:underline mx-auto" | ||
> | ||
Back to Sign In | ||
</Link> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.