Skip to content
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

added new route for forgot password page #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { AuthenticatedUser } from "./types/AuthTypes";
import authAPIClient from "./APIClients/AuthAPIClient";
import * as Routes from "./constants/Routes";
import ManageUserPage from "./components/pages/ManageUserPage";
import ForgotPasswordPage from "./components/auth/ForgotPasswordPage";

const App = (): React.ReactElement => {
const currentUser: AuthenticatedUser | null =
Expand Down Expand Up @@ -73,6 +74,7 @@ const App = (): React.ReactElement => {
<Route exact path={Routes.LOGIN_PAGE} component={Login} />
<Route exact path={Routes.SIGNUP_PAGE} component={Signup} />
<Route exact path={Routes.HOOKS_PAGE} component={HooksDemo} />
<Route exact path={Routes.FORGOT_PASSWORD_PAGE} component={ForgotPasswordPage} />
<PrivateRoute
exact
path={Routes.HOME_PAGE}
Expand Down
45 changes: 45 additions & 0 deletions frontend/src/components/auth/ForgotPasswordPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { useState } from "react";

import authAPIClient from "../../APIClients/AuthAPIClient";
// import { AuthenticatedUser } from "../../types/AuthTypes";
// import AuthContext from "../../contexts/AuthContext";

const ForgotPasswordPage = (): React.ReactElement => {
const [email, setEmail] = useState("");

const onResetPasswordClick = async () => {
await authAPIClient.resetPassword(email);
};

return (
<div>
<div>Header</div>
<div>Text</div>

<form>
<div>
<input
type="email"
value={email}
onChange={(event) => setEmail(event.target.value)}
placeholder="[email protected]"
/>
</div>
<div>
<button
className="btn btn-primary"
type="button"
onClick={onResetPasswordClick}
>
Send reset link to email
</button>
</div>
</form>
<div>
<div>remember your password</div>
</div>
</div>
);
};

export default ForgotPasswordPage;
2 changes: 2 additions & 0 deletions frontend/src/constants/Routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ export const NOT_AUTHORIZED_PAGE = "/not-authorized";
export const MY_ACCOUNT_PAGE = "/account";

export const MANAGE_USERS_PAGE = "/manage-users";

export const FORGOT_PASSWORD_PAGE = "/forgot-password";
Loading