Instead of returning an access denied page on /commerce_pos/login for logged in users, either a message explaining the user is already logged in should be displayed or it should redirect to the register selection page. Having an access denied page might be confusing for users.
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | nicer_login-2986069-23.patch | 2.8 KB | smccabe |
| #21 | nicer_login-2986069-21.patch | 2.26 KB | gmem |
Comments
Comment #2
gmem commentedSmall patch that checks if a user is logged in, then redirects them to the main POS interface.
Comment #3
gmem commentedComment #5
gmem commentedWrote a small test to verify redirect works, unsure why other test is failing but added new permission to test user, which should hopefully fix this issue.
Comment #6
gmem commentedChanged out the requirement for /commerce_pos/login to _access: 'TRUE', which seems to have fixed the tests.
Comment #7
gmem commentedComment #8
gmem commentedNeeds to get route from commerce_pos.main route instead of hardcoding the route, otherwise testbot fails. In practice this would work, but only if the site is not installed to a subdirectory.
Comment #10
gmem commentedTurns out the redirect method wanted a string, not a Url object. Fixed.
Comment #12
gmem commentedFailed test doesn't appear to be related to the patch, although worth an investigation.
Comment #13
smccabe commentedI also was wondering if maybe we should just log the user out and use this as a sort of "switch user" screen as well, since POS is often a shared computer type situation.
Comment #15
smccabe commentedkk confirmed with Ted, going to the login page should just log you out and show the login page. We could put a message indicating that you've been logged out.
Comment #16
gmem commentedRerolled and changed redirect to a logout and Drupal message, would it be better to implement the message into the Twig template itself or just leave it as a Drupal message?
Comment #17
gmem commentedTweaked the test so it tests for the message instead of the redirect previously
Comment #18
gmem commentedComment #19
subhojit777current_userandMessengerTraitare already available in the parent class. You don't need to load them again from services.Comment #20
gmem commentedRemoved the loading of those classes, also put message between double quotes to avoid escaping'.Comment #21
gmem commentedWrong patch file, updated.
Comment #22
gmem commentedComment #23
subhojit777Comment #24
smccabe commentedSlightly updated the test to check that we can actually login and not just that the message shows, otherwise good and I'll merge it in.
Comment #26
smccabe commentedFixed, thanks guys!