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

add query params for roles in login page #25

Merged
merged 4 commits into from
Jun 14, 2024
Merged

Conversation

98ZhaoJeffrey
Copy link
Collaborator

@98ZhaoJeffrey 98ZhaoJeffrey commented Jun 7, 2024

Notion ticket link

Ticket Name

Implementation description

  • Included role types within the login page accepting only administrators, learners and facilitators to login
  • Only allow admins and learners to login, facilitators must signup
  • Redirects to welcome page if role doesn't exist or is blank

Steps to test

  1. Go to /login and check that you are redirected to /welcome
  2. Try /login?role={role} where role here is NOT any of administrator, learner and facilitator (case sensitive) -> should be on /welcome as well
  3. Now try /login?role=facilitator, you should only be able to sign up
  4. Clicking on signup should redirect to /signup?role=facilitator
  5. Now try /login?role={role} where role here is administrator or learner.
  6. The form to login should be here and the sign up button should work the same as for facilitator with the corresponding role
  7. For now, change the user in mongodb to have role learner
  8. Try logging in under /login?role=learner, this should succeed
  9. Try logging in under /login?role=administrator, this should fail and alert you in browser

What should reviewers focus on?

  • Check if the roles displays the correct UI and that login checks the role correctly.

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

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.

LGTM!!! Everything works as expected, thanks for making those fixes!!! 😎

frontend/src/components/auth/Login.tsx Outdated Show resolved Hide resolved
frontend/src/components/auth/Login.tsx Outdated Show resolved Hide resolved
setAuthenticatedUser(user);
};

const onSignupClick = () => {
history.push(SIGNUP_PAGE);
history.push(`${SIGNUP_PAGE}?role=${role}`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

u are awesome for thinking ahead on this thank u!!

@harishan-r harishan-r self-requested a review June 14, 2024 01:26
@cherryyng
Copy link
Collaborator

Everything looks good! All the testing worked as expected!

Copy link
Collaborator

@cherryyng cherryyng left a comment

Choose a reason for hiding this comment

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

Looks good!

@98ZhaoJeffrey 98ZhaoJeffrey merged commit f1862c5 into main Jun 14, 2024
1 check passed
@carolynzhang18 carolynzhang18 deleted the jeffrey/login-routing branch July 17, 2024 02:38
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.

3 participants