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

Forgot password backend logic + frontend design #73

Merged
merged 11 commits into from
Nov 11, 2024
Merged

Conversation

AbeerDas
Copy link
Collaborator

@AbeerDas AbeerDas commented Oct 22, 2024

Notion Ticket Link

Reset Password Page Design Implementation

NEW COMMIT DETAILS

Do the reset password thing but then after it should show a page with a button that counts down from 30 seconds, then sends another email when clicked again. This button should not be clickable before 30 seconds passes. The pages should look like this. Check login dev handoff page for more information if needed.

image
image

When clicked this should be the notification that shows up top-center:

image

I also fixed all the bugs listed by everyone on the thread (thanks everyone). Including the one about the hover showing colours for some of the buttons. Now no colour shows, the cursor just points.

I was thinking in the future we add standardization for the snackbar placement (top-center for all), snackbar colours (Gaurav says there would be three: Sucess, Error, and Info [e.g. the one in this example]). We should also have standardized fonts.

Also, I changed the bodySmall to 12.5px because we do not use 12px anywhere on our designs and having it be 12.5px is the variable that matches the figma designs and it would be better.

Implementation Description

This PR implements the design for the Reset Password page as specified in the Notion ticket. The functionality includes sending a reset link to the user's email and providing navigation options based on the user's authentication state.

Steps to Test

  1. Logout: Run the frontend and backend and then ensure you are logged out
  2. Navigate to http://localhost:3000/forgot-password.
    • Expected Result: The page should load successfully.
      • Should be the same as the figma designs (shown below)

image

  1. Enter the email you use to log in and click "Send reset link...".
    • Expected Result: You should be redirected to a confirmation frame, and the confirmation message should display the email you just entered.
      • Should look the same as the figma designs (shown below)

image

Confirmation Message
4. Click "Not your email?".

  • Expected Result: You should be taken back to the previous page.

Previous Page
5. Click "Remember Your Password?".

  • Expected Result: You should be redirected back to the main page.
  1. After logging in, navigate back to http://localhost:3000/forgot-password.

    • Expected Result: You should be redirected to the Home Page, preventing access to the Forgot Password page while logged in.

    Home Page Redirection

Review Focus Areas

  • Code Standards: Since this is my first pull request, I would appreciate feedback on adherence to coding standards. Are there better practices for using variables/hooks?
  • Styling Format: Is the styling format applied in this PR acceptable for future implementations?
  • Backend Routes: Does the backend implementation for additional routes meet our standards and expectations?
  • Try catch block: ForgotPasswordPage line 34 I wrote setIsEmailSent(false) (little redundant), however I am not sure what else to put there so maybe look into that

Checklist

  • My PR title is descriptive and uses imperative tense.
  • My commit messages are clear, descriptive, and written in imperative tense. Commits are atomic, and trivial ones are squashed or fixed into more meaningful commits.
  • I have run the appropriate linter(s).
  • I have requested a review from the Product Lead and relevant developers who have context on this PR or will build upon it.

@carolynzhang18
Copy link
Collaborator

@AbeerDas Is the button colour supposed to become blue on hover, or should it be a darker green? I'm seeing this on hover right now:
image
I just wanna check with you that that's what was intended in the design :D

Copy link
Collaborator

@carolynzhang18 carolynzhang18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great first PR!! 😎 Everything works as described and matches the design! 💪

I left a few comments - we can go over them at tonight's work sesh :D

Some general things:

  • There's a few linter errors - could you run ./scripts/run_linter (assuming you have Docker running - if not, you can run yarn fix under frontend/ and backend/)? You might need to resolve some of the linter complaints manually, but this should be quick :)
  • We have some theming set up for the app already - there are some styles you've hardcoded that we should be able to replace with things already in our theme :)

@@ -33,7 +33,7 @@ baseAPIClient.interceptors.request.use(async (config: AxiosRequestConfig) => {
decodedToken.exp <= Math.round(new Date().getTime() / 1000))
) {
const { data } = await axios.post(
`${process.env.REACT_APP_BACKEND_URL}/auth/refresh`,
`${process.env.REACT_APP_BACKEND_URL}auth/refresh`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmmm this might break things 🤔
I have REACT_APP_BACKEND_URL="http://localhost:8080" as my env variable, which wouldn't pair well without the /

package.json Outdated
Comment on lines 1 to 5
{
"devDependencies": {
"nodemon": "^3.1.7"
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this file added by accident? :D

Comment on lines 37 to 46
const link = document.createElement("link");
link.href = "https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@400;600&display=swap";
link.rel = "stylesheet";
document.head.appendChild(link);

const theme = createTheme({
typography: {
fontFamily: "'Lexend Deca', sans-serif",
},
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design question - is Lexend Deca the only font used throughout our app?
If yes, I think it would be better to plop this theming into frontend/src/theme/theme.ts :)
If no... then we might need to get more creative lol

Comment on lines 80 to 81
<ThemeProvider theme={theme}>
<CssBaseline />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have ThemeProvider in index.tsx that's grabbing the theme from frontend/src/theme/theme.ts already. It'd be best to only have this in one place, so adding onto my comment above - if we can put the new font in our existing theme, then we can use our existing theming!

Copy link
Collaborator

@ji-mmyliu ji-mmyliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works great! After Carolyn's comments resolved and linter run, LGTM 🚀

Copy link
Collaborator

@jasondsouza35 jasondsouza35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great to me! everything works like it should so i think that's awesome!

one small thing i noticed, not really sure if it's important, but is nice for consistency. When you hover over the "Not your email...." link, the background of that is slightly highlighted but when you hover over the "Remember your password..." link, that's not the case. Take a look and let me know what you think. Besides that, there seems to be some github linting things coming up but i dont think that's a huge deal.

Screenshot 2024-11-04 at 9 08 14 PM Screenshot 2024-11-04 at 9 09 55 PM

Awesome work abeer! 💯

@Astoriaaaa
Copy link
Collaborator

Everything looks good to me. All functionalities work!! There was the issue with the background when hovering on the "send reset link to email" but I think Carolyn commented on that. Great work 🤩

Copy link
Collaborator

@carolynzhang18 carolynzhang18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WOOHOO SUPER DUPER AMAZING 🧑‍🍳🧑‍🍳🧑‍🍳

@AbeerDas AbeerDas merged commit 0c0d12d into main Nov 11, 2024
1 of 2 checks passed
@AbeerDas AbeerDas deleted the abeer/forgot-password branch November 11, 2024 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants