O'Reilly logo

Programming Phoenix by Jose Valim, Bruce Tate, Chris McCord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing Login and Logout

We made great progress in the last section. We created a module plug that loads information from the session, used this information to restrict user access and then created the functionality that allows us to finally store users in the session.

We’re almost done with our authentication feature. We need to implement both login and logout functionality, as well as change the layout to include links to those pages.

First things first. We need to add some new routes to web/router.ex:

 scope ​"​​/"​, Rumbl ​do
  pipe_through ​:browser​ ​# Use the default browser stack
 
  get ​"​​/"​, PageController, ​:index
  resources ​"​​/users"​, UserController, ​only:​ [​:index ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required