Creating a user login page

To create our user login experience, we'll need to start by creating a session controller that will be responsible for a few separate operations:

  1. Users must be able to log in through some form.
  2. Users must get logged in, set something in the user's session, and redirect out somewhere.
  3. Users must be able to log out.

The best way for us to accomplish this is to create a separate sessions resource, where create represents the posted login that sets the user session and redirects. We'll also want a way to log in and log out (although we'll want to handle those separately). We'll start out with a few simple basics. To start, we need to modify our routes to include these new methods, and we'll also probably want to create ...

Get Phoenix Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.