authenticationcanjscanjs-routing

Authentication and Navigation in CanJs


What will be the best way to render the home page (after authentication). Let's say it have a leftNav and Content. Can we have these sections in login.html and initialize their controllers once authentication was cleared ? Is it best practice to initialize them inside the router controller ? What will be the role of can.route in this ?

Could not find much example on this.


Solution

  • My personal opinion is that authentication should be a separate page altogether. You direct the user to a login page and when they have authenticated redirect them to the application page. If they go to the application page without being authenticated you simply redirect them to the login page.