I have a website that allows to check in/out items. When a user clicks "Check Out" without being logged in, they are redirected to a page that explains that they were not logged in.

Is there a better way to handle this? What should I do if a user is not logged in?

Would it be more user-friendly to just redirect to the login page?

4 Answers 4


It's generally a good idea to avoid error situations. So, rather than showing an error message after the user clicks the Check Out button (or, even worse, navigating to a separate "error message" page), don't allow the user to click the button in the first place. Hide it or deactivate it.

If you must show error messages, show them on the page where the action was taken. Being sent to a different page takes users out of context, out of their task.

There are a number of ways to handle this, and your particular UI will probably dictate a particular solution. But the general principle is to help your users avoid errors.

  • Oh, this is a good idea. I could grey out the buttons and then show a message on hover.
    – anna328p
    May 4, 2017 at 18:11
  • Also, consider using a login modal. That way, the user can login without navigating away from their current page. It's less of an interruption to the user's task that way. May 4, 2017 at 18:12
  • Hmmm... I know very little JS but I could do this. No idea how to integrate it with Google sign-in though - I'm using this and it needs to be loaded in its own page.
    – anna328p
    May 4, 2017 at 18:13
  • Whatever you do, think about the task the user is trying to accomplish, and recognize that logging in and recovering from errors are obstacles to completing that task. Make those obstacles small or eliminate them if possible. #UXGoldenRule May 4, 2017 at 18:19

This is a good way to do it.

Show the user why he is redirected to the page he is at. Redirecting him to the login page would confuse him.

Always make sure the user know where he is, how he got there and where he can go. You do this with your redirection page and call-to-action button.

  • right... I just thought of something. Would it be better to have a login link on the error page?
    – anna328p
    May 4, 2017 at 17:56
  • Yes, your 'home' button could go to login. Have both options; login and return to home. May 4, 2017 at 18:07

Just show a login model with a message "For checking out you will need to login" and have your normal login fields available. If the user was doing something and session have not checked in, make sure you tell the user "your data was saved and you will start where you left".

Redirecting to login screen is a bad idea, users will freak out, especially if they were in middle of doing something.

  • I can't use a modal with fields since I use exclusively Google OAuth login. I can show a modal with a login button though.
    – anna328p
    May 6, 2017 at 5:42
  • In this case (because you limited control over technical stuff), you can redirect user to login rather adding just a login button in a model. By adding just login button will add another useless click for the user. Make sure user have enough information that they have been redirected to login page and their previous work is saved so once they will login they will start where they left.
    – VB2001
    May 8, 2017 at 0:17
  • What about a popup with a login box?
    – anna328p
    May 8, 2017 at 0:17
  • Well you said "I can't use a modal with fields since I use exclusively Google OAuth login." in that case you will have to do a redirect which is the only option left but show appropriate message to the user. Model in this case adding another complexity.
    – VB2001
    May 8, 2017 at 0:54
  • I mean a popup, not a modal.
    – anna328p
    May 8, 2017 at 0:55

Clicking on the "check out" item redirects you to the login page.

If the user does not have a login to the site, it allows him to register (fast registration, only with the main fields).

And after logging in or registering, go back to the purchase screen.

The interesting thing is not to require many clicks from the user in this part of login because the user may lose interest in buying the product if the interface makes the process difficult.

  • I'm not selling anything - this is similar to a library type thing
    – anna328p
    May 4, 2017 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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