Ready to get started?

Join Adocasts Plus for $8.00/mo, or sign into your account to get access to all of our lessons.

robot mascot smiling

Adding the Remember Me Token

In this lesson, we'll enable the remember me feature on our auth login flow and add the remember me tokens table to our database.

Published
Oct 21, 24
Duration
5m 45s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

Get the Code

Download or explore the source code for this lesson on GitHub

Repository

Chapters

00:00 - Adding the Remember Me checkbox to our Login Form
02:06 - Adding the Remember Flag to our Validator & WebLogin Action
02:43 - Enabling the Remember Me AdonisJS Feature
04:48 - Testing Our Login

You can find the remember_me_tokens migration in the documentation, or copy the contents from below.

import { BaseSchema } from '@adonisjs/lucid/schema'

export default class extends BaseSchema {
  protected tableName = 'remember_me_tokens'

  async up() {
    this.schema.createTable(this.tableName, (table) => {
      table.increments()
      table
        .integer('tokenable_id')
        .notNullable()
        .unsigned()
        .references('id')
        .inTable('users')
        .onDelete('CASCADE')

      table.string('hash').notNullable().unique()
      table.timestamp('created_at').notNullable()
      table.timestamp('updated_at').notNullable()
      table.timestamp('expires_at').notNullable()
    })
  }

  async down() {
    this.schema.dropTable(this.tableName)
  }
}

Ready to get started?

Join Adocasts Plus for $8.00/mo, or sign into your account to get access to all of our lessons.

Join The Discussion! (4 Comments)

Please sign in or sign up for free to join in on the dicussion.

  1. Commented 1 month ago

    Hello,

    First of all, thank you for the high-quality content you provide.

    However, I would like to ask if it would be possible to improve the video player when subtitles are enabled. Let me explain my issue: I am French, and I watch your videos with subtitles, but I often find myself pausing when the sequence moves too quickly. At that point, the progress bar appears over the subtitles, which makes it quite frustrating to read them.

    For a 5-minute video, it’s manageable, but when watching a lot of videos back-to-back, such as in this section, it becomes very tiresome. Perhaps it would be a good idea to make the subtitles move upward alongside the progress bar when the video is paused.

    I apologize if this is not the right place for this type of feedback.
    Thank you for taking the time to read my message.

    1

    Please sign in or sign up for free to reply

    1. Commented 1 month ago

      Hello, tigerwolf!

      Sorry about the inconvenience!! Thankfully, the video host we're using for these videos allows specifying custom CSS within the player's iframe, and I was able to get the captions pushed up when the video toolbar is shown. I also hid the heatmap, which seems to be mostly what was going over the subtitles.

      We're in the process of switching from an actual video host to Cloudflare R2 with a hand-picked player, so hopefully we'll have more improvements in this area down the road!

      Thank you very much for the feedback!!

      1

      Please sign in or sign up for free to reply

      1. Commented 1 month ago

        Unbelievable !!! :-O
        I wanted to sincerely thank you for your incredibly fast response to my comment. It’s amazing how quickly you managed to address the issue! I truly appreciate the effort and responsiveness.

        Thank you again for your work and dedication!

        1

        Please sign in or sign up for free to reply

        1. Commented 1 month ago

          My pleasure, tigerwolf!! Happy to be able to help! 😊

          0

          Please sign in or sign up for free to reply