Want to have access to everything?

Go PRO to have access to this lesson and the entire Adonis Mastery library. Already a PRO? Sign in to continue learning!

Remember me

Making users log in every single time they visit our application might not be the best in terms of user experience. What if users could indicate they want to be remembered for subsequent visits at the point of logging in? In this lesson, we'll cover how to do just that.

What you'll learn

  • How to remember users for subsequent visits
  • How the remember me functionality works
  • Implementing remember me with both the attempt and login methods

End-to-end Authentication

1hr 12mins
10 lessons
Beginner

Getting Started

Welcome to the end-to-end authentication course. As usual, let's take a look at the overview of the course and what we'll be building.

This course will focus more on the backend logic, so I have prepared a starter project which we'll build on. The starter project contains the necessary base markup as well as some basic setup. You can grab the starter project from GitHub.

Before we can perform any kind of authentication in AdonisJS, we need to first install and configure the auth module. In this lesson, we'll be doing just that.

Register

With all the setup out of the way, let's add our first functionality, which is user registration.

Email verification

One way of making sure your application is been used by actual users is to ensure users verify their email addresses. You can decide to restrict access to only certain features pending upon email verification or restrict total access until email verification. In this lesson, we are going to implement email verification.

In the last lesson, we saw how to send email verification links to users upon creating an account. Now, let's add the implementation for users to actually verifying their email addresses.

There are times for whatsoever reasons users don't get sent the verification emails or maybe the one they were sent got expired. In this lesson, we allow users the ability to request verification emails to be resent.

Login

Let's move on to allow users to log in to their account. As I mentioned a couple of lessons ago, we can decide to restrict access to only certain features pending upon email verification or restrict total access until email verification. In this lesson, we'll be covering the first scenario.

What you'll learn

  • Log in using the attempt method
  • Display authenticated user data in a view
  • Check whether a user is logged in or not in a view

Now, let's cover the other scenario where we'll restrict logging in to only users that have verified their email addresses.

What you'll learn

  • Log in using the login method
  • Manually verify hashed password
  • Two ways to handle checking whether user's email address has been verified

Making users log in every single time they visit our application might not be the best in terms of user experience. What if users could indicate they want to be remembered for subsequent visits at the point of logging in? In this lesson, we'll cover how to do just that.

What you'll learn

  • How to remember users for subsequent visits
  • How the remember me functionality works
  • Implementing remember me with both the attempt and login methods
Chimezie Enyinnaya

Hi, I'm Chimezie Enyinnaya, your teacher.

I’m a self-taught software developer based in Lagos, Nigeria, with over 8 years of experience. In the last couple of years, I've been doing more teaching because I enjoy sharing my knowledge so that others can benefit from it. Come along as I teach you all I know about AdonisJS, Node.js, and JavaScript at large!

Source code
Lesson video (SD)
Lesson video (HD)

No comments yet.