Skip to content

[Task 9] Login #53

@MZabolotnev

Description

@MZabolotnev

Task: Implement a Login Form

Objective

  • Implement a login form with email and password fields.
  • The page should match to the provided design.
  • Client-side validation is required, including mandatory fields and valid email checks. You can use browser validation or a library of your choice.
  • For login, you need to send a request to the API: https://ma-backend-api.mocintra.com/api/v1/auth/login
  • Upon successful login, you will receive tokens that need to be stored in the application's memory or session storage.
  • After login, redirect to the home page.
  • In case of unsuccessful login, display an error to the user.
  • When navigating to the cart, check if the user is logged in by sending a request to the endpoint: https://ma-backend-api.mocintra.com/api/v1/auth/verify. This endpoint requires the AccessToken in the Authorization header in the format 'Bearer accessToken'.

image

  • If the user is not logged in or the token is invalid, redirect to the login page. An unauthenticated user should not be able to add items to the cart and should be redirected to the login form.
  • The login and logout buttons (for storing and deleting tokens) should function correctly.

Additional Task (Optional):

  • Write custom validation for each field. Use a smart form or a library at your discretion.

Useful Links

Users

[
      {
        id: 1,
        email: 'john@mail.com',
        password: 'changeme',
        name: 'Jhon',
        role: Role.customer,
        avatar: 'https://i.imgur.com/LDOO4Qs.jpg',
      },
      {
        id: 2,
        email: 'maria@mail.com',
        password: '12345',
        name: 'Maria',
        role: Role.customer,
        avatar: 'https://i.imgur.com/DTfowdu.jpg',
      },
      {
        id: 3,
        email: 'admin@mail.com',
        password: 'admin123',
        name: 'Admin',
        role: Role.admin,
        avatar: 'https://i.imgur.com/yhW6Yw1.jpg',
      },
    ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions