Skip to content

[#6][#7] As a user, I can sign-in using my email and password | Front-end & back-end#30

Merged
longnd merged 24 commits intodevelopfrom
feature/login
Sep 20, 2021
Merged

[#6][#7] As a user, I can sign-in using my email and password | Front-end & back-end#30
longnd merged 24 commits intodevelopfrom
feature/login

Conversation

@longnd
Copy link
Owner

@longnd longnd commented Apr 19, 2021

Resolves #6, Resolves #7

What happened

  • Implements the Sign-in feature: user can use a valid username & password to log in.
  • Adds 2 new pipelines:
    • :ensure_auth - when applied on a route, the user must log in before accessing
    • :skip_after_auth - when applied on a route, the route will be skipped if the user already logged in and redirects the user to the dashboard page.

Insight

To authenticate the user, this PR uses the guardian package (Github). It provides:

  • The EnsureAuthenticatedPlug to force the user to log in before accessing a route
  • Some built-in methods to log in a user and get the current user. We need to implement some methods as required by Guardian in:
    defmodule Gscraper.Guardian.Authentication do
    @moduledoc """
    Implementation module for Guardian and functions for authentication.
    """
    use Guardian, otp_app: :gscraper
  • The ErrorHandler is also required by Guardian is implemented in:
    defmodule Gscraper.Guardian.ErrorHandler do
    @behaviour Guardian.Plug.ErrorHandler
    use GscraperWeb, :controller
    @impl Guardian.Plug.ErrorHandler

Proof Of Work

Screen.Recording.2021-09-12.at.10.13.41.mov

@longnd longnd added this to the 1.0.0 milestone Apr 19, 2021
@longnd longnd self-assigned this Apr 19, 2021
@longnd longnd changed the base branch from develop to feature/sign-up-backend April 19, 2021 08:57
@longnd longnd force-pushed the feature/sign-up-backend branch from 987affc to df9e0cc Compare April 20, 2021 01:23
@longnd longnd force-pushed the feature/login branch 2 times, most recently from 875ca80 to 94beb71 Compare April 20, 2021 04:20
Base automatically changed from feature/sign-up-backend to develop April 20, 2021 08:18
@longnd longnd changed the title As a user, I can sign-in using my email and password [#6][#7] As a user, I can sign-in using my email and password Apr 20, 2021
@longnd longnd force-pushed the feature/login branch 2 times, most recently from bab02dc to 6a44cc1 Compare April 20, 2021 08:22
@longnd longnd force-pushed the feature/login branch 3 times, most recently from ab0aace to 3a83a92 Compare September 7, 2021 15:36
@longnd longnd changed the base branch from develop to chore/refactor-the-account-context September 7, 2021 15:37
@longnd longnd marked this pull request as ready for review September 12, 2021 02:58
@longnd longnd temporarily deployed to elixir-gscra-feature-lo-mncovh September 12, 2021 04:11 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 12, 2021 04:18 Inactive
@longnd longnd changed the title [#6][#7] As a user, I can sign-in using my email and password [#6][#7] As a user, I can sign-in using my email and password | Front-end & back-end Sep 12, 2021
@longnd longnd requested review from hanam1ni and rosle September 12, 2021 04:28
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 15, 2021 08:44 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 15, 2021 08:54 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 15, 2021 08:57 Inactive
Base automatically changed from chore/refactor-the-account-context to develop September 15, 2021 09:02
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 15, 2021 15:13 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 15, 2021 15:16 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 15, 2021 15:19 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 20, 2021 01:20 Inactive
Copy link
Collaborator

@hanam1ni hanam1ni left a comment

Choose a reason for hiding this comment

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

Small comments, the rest LGTM 👍

@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 20, 2021 06:23 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 20, 2021 06:23 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 20, 2021 06:25 Inactive
@longnd longnd temporarily deployed to elixir-gscraper-pr-30 September 20, 2021 06:28 Inactive
@longnd longnd requested a review from hanam1ni September 20, 2021 06:32
Copy link
Collaborator

@rosle rosle left a comment

Choose a reason for hiding this comment

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

👍

@longnd longnd merged commit 702fdc9 into develop Sep 20, 2021
@longnd longnd deleted the feature/login branch September 20, 2021 11:32
@longnd longnd mentioned this pull request Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BACKEND] As a user, I can sign-in using my email and password [FRONTEND] As a user, I can sign-in using my email and password

3 participants