InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

Redirect from login view

Open SchrodingersGat opened this issue 6 years ago • 6 comments

When a user is not "logged in" and tries to access a page, they are redirected to the login page (as is desired). However after logging in they are sent to the home page. Instead, they should be sent to the page they were originally trying to access.

SchrodingersGat avatar Apr 21 '20 02:04 SchrodingersGat

Hello again! I'm new to all this and I'm trying to find a good first issue. I've completed an online course that gave me familiarity with java, html, and css and the MEN stack and I'm working through the MIT online courseware for python right now. would this be a good first issue? Thanks so much for your response!

andyseracuse avatar Apr 24 '20 15:04 andyseracuse

This would be a great issue to start with!

To get you started, the 'login' page is rendered here: https://github.com/inventree/InvenTree/blob/master/InvenTree/templates/registration/login.html

And the code which is responsible for redirecting an unauthenticated user to the login page is under AuthRequiredMiddleware - https://github.com/inventree/InvenTree/blob/master/InvenTree/InvenTree/middleware.py

SchrodingersGat avatar Apr 24 '20 22:04 SchrodingersGat

great! I am gonna start working on this. Can you assign me? Also, to be clear, as far as I can tell you can't access any page without being logged first. Is the user in question trying to access a part by it's URL and then being redirected to the login page?

andyseracuse avatar Apr 28 '20 22:04 andyseracuse

Also, to be clear, as far as I can tell you can't access any page without being logged first. Is the user in question trying to access a part by it's URL and then being redirected to the login page?

Yep, exactly. Sometimes if the browser logs you out, but the page is still "loaded" in the browser, you'll click on a link and instead be redirected to the login page and then have to find your way back.

SchrodingersGat avatar Apr 28 '20 23:04 SchrodingersGat

i pushed a fix, but then I hit close and comment. I think it made it through though? let me know if I need to do anything else on my end. Cheers!

andyseracuse avatar May 03 '20 20:05 andyseracuse

You can hit "reopen" if you prematurely close it - I have now reopened it for you. But it appears there are still some kinks to work out

SchrodingersGat avatar May 03 '20 22:05 SchrodingersGat