0

My website has three pages:

  1. /
  2. /login
  3. /dashboard

When an user goes to /, if the user is logged, it redirects to /dashboard, but when is not logged, it redirects to /login.

But I want to know what is the best thing to do when a logged user goes to /login?

Should I redirect him to /dashboard? Or should I log him out and show the /login page?

2

I think if the user is already logged in, and they enter the URL for the login page, they should redirect to whatever page a user would be directed to AFTER they have logged in, so in your case, the dashboard page. You see this behaviour with most sites. Having said that, I think a cleaner approach is to have the index page, a login page (this may or may not be appropriate for your site) therefore, when the user goes to your root URL, they can login from that page. If they are already logged in, it automatically redirects to the the dashboard.

| improve this answer | |
  • Agreed. Follow the user desired page and you can't fail. Assuming Login is the first page, then answer the following question: what is the desired behavior of someone who is logged in, to see home or to see /dashboard? – Jamezrp Oct 27 '14 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.