Redirect to originally requested url after login does not work
When I navigate to a particular resource on a schleuder-web interface with no pre-existing session, then I am not properly redirected to that url after login.
Steps to reproduce
- open an incognito window
- visit some-schleuder-web/lists/some_list
- login
- it wrongly redirects to / instead of /lists/some_list
- logout
- visit some-schleuder-web/lists/some_list again
- login
- it correctly redirects to /lists/some_list
Potential Fix
I am pretty sure the error is at https://0xacab.org/schleuder/schleuder-web/-/blob/master/app/controllers/application_controller.rb#L87 as I get the following error in the logs: Error: no implicit conversion of nil into String
.
I would suggest a fix along these lines:
def authenticate
- expiry = Time.parse(session[:login_expires_at])
- if current_account && expiry > Time.now
+ expiry = Time.parse("#{session[:login_expires_at]}") rescue nil
+ if current_account && expiry && expiry > Time.now
update_session_expiry
However, what seems to be an additional issue is that the message at https://0xacab.org/schleuder/schleuder-web/-/blob/master/app/controllers/application_controller.rb#L110 is never displayed in the login form. The login form always says "please log in with your schleuder account" and does not display the error.