From ab1b589e9d8aedacd20a1bc94e02bb4f528c14db Mon Sep 17 00:00:00 2001 From: Mehana Nagarur Date: Mon, 6 Apr 2026 17:21:25 -0400 Subject: [PATCH 1/3] made the new password page --- .../src/app/components/NewPasswordForm.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 apps/frontend/src/app/components/NewPasswordForm.tsx diff --git a/apps/frontend/src/app/components/NewPasswordForm.tsx b/apps/frontend/src/app/components/NewPasswordForm.tsx new file mode 100644 index 0000000..6822694 --- /dev/null +++ b/apps/frontend/src/app/components/NewPasswordForm.tsx @@ -0,0 +1,21 @@ +'use client'; + +import React from 'react'; +import TextInputField from './TextInputField'; +import { Button } from '@chakra-ui/react'; + +export default function NewPasswordForm() { + return ( +
+

Reset Password

+
+ + +
+ {/* TODO: form validation*/} + +
+ ); +} \ No newline at end of file From b4c906d959bc00ce649f61480623a2eabcdefce9 Mon Sep 17 00:00:00 2001 From: Mehana Nagarur Date: Mon, 6 Apr 2026 22:44:24 -0400 Subject: [PATCH 2/3] made the reset password confirmation page --- .../components/ResetPasswordConfirmation.tsx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 apps/frontend/src/app/components/ResetPasswordConfirmation.tsx diff --git a/apps/frontend/src/app/components/ResetPasswordConfirmation.tsx b/apps/frontend/src/app/components/ResetPasswordConfirmation.tsx new file mode 100644 index 0000000..fc5682e --- /dev/null +++ b/apps/frontend/src/app/components/ResetPasswordConfirmation.tsx @@ -0,0 +1,24 @@ +'use client'; + +import React from 'react'; +import { Button } from '@chakra-ui/react'; +import { useRouter } from 'next/navigation'; + + +export default function ResetPasswordConfirmation() { + const router = useRouter(); + + return ( +
+
+

Password Changed

+
Your password has been successfully changed!
+
+ {/*TODO: figure out how to connect the button to login page */} + +
+ ); +} \ No newline at end of file From a2d96b82eec47942daf89e65484f4879590fb1bd Mon Sep 17 00:00:00 2001 From: Mehana Nagarur Date: Wed, 8 Apr 2026 18:54:49 -0400 Subject: [PATCH 3/3] added tests for the new pages and moved the login page so we can route to it --- .../LoginPage.tsx => login/page.tsx} | 2 +- .../test/components/LoginPage.test.tsx | 2 +- .../test/components/NewPasswordForm.test.tsx | 22 +++++++++++ .../ResetPasswordConfirmation.test.tsx | 37 +++++++++++++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) rename apps/frontend/src/app/{components/LoginPage.tsx => login/page.tsx} (95%) create mode 100644 apps/frontend/test/components/NewPasswordForm.test.tsx create mode 100644 apps/frontend/test/components/ResetPasswordConfirmation.test.tsx diff --git a/apps/frontend/src/app/components/LoginPage.tsx b/apps/frontend/src/app/login/page.tsx similarity index 95% rename from apps/frontend/src/app/components/LoginPage.tsx rename to apps/frontend/src/app/login/page.tsx index 08bfd2c..b883d1f 100644 --- a/apps/frontend/src/app/components/LoginPage.tsx +++ b/apps/frontend/src/app/login/page.tsx @@ -1,7 +1,7 @@ 'use client'; import React from 'react'; -import TextInputField from './TextInputField'; +import TextInputField from '../components/TextInputField'; import Link from 'next/link'; import { Button } from '@chakra-ui/react'; diff --git a/apps/frontend/test/components/LoginPage.test.tsx b/apps/frontend/test/components/LoginPage.test.tsx index e1418b8..d6b9a90 100644 --- a/apps/frontend/test/components/LoginPage.test.tsx +++ b/apps/frontend/test/components/LoginPage.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '../utils'; -import LoginPage from '@/app/components/LoginPage'; +import LoginPage from '@/app/login/page'; describe('Login Page Component', () => { diff --git a/apps/frontend/test/components/NewPasswordForm.test.tsx b/apps/frontend/test/components/NewPasswordForm.test.tsx new file mode 100644 index 0000000..031971a --- /dev/null +++ b/apps/frontend/test/components/NewPasswordForm.test.tsx @@ -0,0 +1,22 @@ +import { render, screen } from '../utils'; +import NewPasswordForm from '@/app/components/NewPasswordForm'; + + +describe('New Password Form Component', () => { + it('renders the form heading', () => { + render(); + expect(screen.getByText('Reset Password', { selector: 'h1' })).toBeInTheDocument(); + }); + + it('renders the 2 password input fields', () => { + render(); + expect(screen.getByPlaceholderText('Enter new password')).toBeInTheDocument(); + expect(screen.getByPlaceholderText('Retype password')).toBeInTheDocument(); + }); + + it('renders the reset password button', () => { + render(); + const button = screen.getByRole('button', { name: 'Reset Password' }); + expect(button).toBeInTheDocument(); + }) +}); \ No newline at end of file diff --git a/apps/frontend/test/components/ResetPasswordConfirmation.test.tsx b/apps/frontend/test/components/ResetPasswordConfirmation.test.tsx new file mode 100644 index 0000000..c291105 --- /dev/null +++ b/apps/frontend/test/components/ResetPasswordConfirmation.test.tsx @@ -0,0 +1,37 @@ +import { render, screen } from '../utils'; +import ResetPasswordConfirmation from '@/app/components/ResetPasswordConfirmation'; + +const mockPush = jest.fn(); + +jest.mock('next/navigation', () => ({ + useRouter: () => ({ + push: mockPush, + }), +})); + + +describe('Reset Password Confirmation Page Component', () => { + + it('renders the page heading', () => { + render(); + expect(screen.getByText('Password Changed', { selector: 'h1' })).toBeInTheDocument(); + }); + + it('renders the subheading', () => { + render(); + expect(screen.getByText('Your password has been successfully changed!', { selector: 'h5' })).toBeInTheDocument(); + }); + + it('renders the back to login button', () => { + render(); + const button = screen.getByRole('button', { name: 'Back to login' }); + expect(button).toBeInTheDocument(); + }) + + it('navigates to login page when back to login button is clicked', () => { + render(); + const button = screen.getByRole('button', { name: 'Back to login' }); + button.click(); + expect(mockPush).toHaveBeenCalledWith('/login'); + }); +}); \ No newline at end of file