CSDUMMI

Results 126 comments of CSDUMMI

A possible bug fix could be to replace `store_location_for` by a stack, that is pushed to on any call to `store_location_for` and pops an element for every call of `stored_location_for`.

I have experimented with this approach and can now tell you, that implementing a stack does not work. You can see my fork of devise [here](https://gitlab.com/CSDUMMI/devise)

I suspect that this is because session data is removed once a user has logged in.

I have added logging of `store_location_for` and `stored_location_for` functions. Here are the logs I collected during signing in via SSO. ``` bundle[35633]: [Store Location] Storing location for user(https://mastodon/)[a5ec7849-138a-4e2b-aa5e-f5d16816de99] method=GET path=/...

``` bundle[35633]: [Store Location] Storing location for user(https://mastodon/oauth/authorize?client_id=U8ZPX1457l2tHebviRsx19VHuSgXVE5x_uXW9Wg4W4g&redirect_uri=https%3A%2F%2Fpinafore.social%2Fsettings%2Finstances%2Fadd&response_type=code&scope=read%20write%20follow%20push)[33fa4e02-0890-46e2-9fce-481973132eac] method=GET path=/oauth/authorize format=html controller=Oauth::AuthorizationsController action=new status=302 duration=3.83 view=0.00 db=0.00 location=https://mastodon/auth/sign_in bundle[35626]: [Store Location] Reading stored location: user[Store Location] No locations storedRedirecting after...

Ok. I believe the cause of this issue might be: [``expire_data_after_sign_in!`](https://gitlab.com/CSDUMMI/devise/-/blob/main/lib/devise/controllers/sign_in_out.rb#L108). This function removes all keys in the session after the login that start with `devise`

Although the location stored is called `user_return_to`.

I have found a hacky solution to this issue. When you run this [fork of Mastodon](https://gitlab.com/babka_net/mastodon-babka) on the `redirect_to_idp` branch, you'll be redirected after a login to the site you...

This branch also still contains a lot of extraneous logging that needs to be removed prior to any release.

Is this issue still valid on the current main branch? I fail to reproduce the issue now.