Skip to content

Commit

Permalink
feat: implement back navigation on some of the auth flows, closes RX-13
Browse files Browse the repository at this point in the history
  • Loading branch information
AmruthPillai committed Nov 22, 2023
1 parent bc5b4cb commit da2f4db
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
14 changes: 11 additions & 3 deletions apps/client/src/pages/auth/backup-otp/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { zodResolver } from "@hookform/resolvers/zod";
import { t } from "@lingui/macro";
import { ArrowLeft } from "@phosphor-icons/react";
import { twoFactorBackupSchema } from "@reactive-resume/dto";
import { usePasswordToggle } from "@reactive-resume/hooks";
import {
Expand Down Expand Up @@ -85,9 +86,16 @@ export const BackupOtpPage = () => {
)}
/>

<Button type="submit" disabled={loading} className="mt-4 w-full">
{t`Sign in`}
</Button>
<div className="mt-4 flex items-center gap-x-2">
<Button variant="link" className="px-5" onClick={() => navigate(-1)}>
<ArrowLeft size={14} className="mr-2" />
<span>{t`Back`}</span>
</Button>

<Button type="submit" disabled={loading} className="flex-1">
{t`Sign in`}
</Button>
</div>
</form>
</Form>
</div>
Expand Down
16 changes: 13 additions & 3 deletions apps/client/src/pages/auth/forgot-password/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { zodResolver } from "@hookform/resolvers/zod";
import { t } from "@lingui/macro";
import { ArrowLeft } from "@phosphor-icons/react";
import { forgotPasswordSchema } from "@reactive-resume/dto";
import {
Alert,
Expand All @@ -16,13 +17,15 @@ import {
import { useState } from "react";
import { Helmet } from "react-helmet-async";
import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom";
import { z } from "zod";

import { useForgotPassword } from "@/client/services/auth";

type FormValues = z.infer<typeof forgotPasswordSchema>;

export const ForgotPasswordPage = () => {
const navigate = useNavigate();
const [submitted, setSubmitted] = useState<boolean>(false);
const { forgotPassword, loading } = useForgotPassword();

Expand Down Expand Up @@ -85,9 +88,16 @@ export const ForgotPasswordPage = () => {
)}
/>

<Button type="submit" disabled={loading} className="mt-4 w-full">
{t`Send Email`}
</Button>
<div className="mt-4 flex items-center gap-x-2">
<Button variant="link" className="px-5" onClick={() => navigate(-1)}>
<ArrowLeft size={14} className="mr-2" />
<span>{t`Back`}</span>
</Button>

<Button type="submit" disabled={loading} className="w-full">
{t`Send Email`}
</Button>
</div>
</form>
</Form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/auth/verify-otp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const VerifyOtpPage = () => {
<div className="space-y-1.5">
<h2 className="text-2xl font-semibold tracking-tight">{t`Two-Factor Authentication`}</h2>
<h6>
<span className="opacity-75">
<span className="leading-relaxed opacity-60">
{t`Enter the one-time password provided by your authenticator app below.`}
</span>
<Button asChild variant="link" className="px-1.5">
Expand Down

0 comments on commit da2f4db

Please sign in to comment.