Closed gabrieletassoni closed 1 year ago
I was unable to reproduce this following the steps provided (needed to add a couple steps to specify the rails_admin
and devise
gems in the Gemfile - and I used SQLite instead of PG - but otherwise followed these exactly and am able to login without issue).
I see a couple queries to models not covered in your repro steps (eg. Permissions
, which I'm guessing that's where the issue stems from) - please include your rails_admin
initializer and any additional configuration needed, or reproduce the issue in a separate repo.
I see a couple queries to models not covered in your repro steps (eg.
Permissions
, which I'm guessing that's where the issue stems from) - please include yourrails_admin
initializer and any additional configuration needed, or reproduce the issue in a separate repo.
Yes, you are right, starting completely from scratch, without any added Gem, it works flawlessy. I need to add gems one by one to understand what's going on. The thing was completely working for years in different projects from rails 5 to rails 6.1 and I made some gems that helped me bootstrapping an application in a fast way, but with rails 7 and ruby 3.1 something has changed and I need to port all the gems I maintain to the new setup (latest rails_admin, rails and ruby), one by one.
Thank you for the hint, closing this.
Describe the bug Using a newly created rails 7 app, I tried Devise for authentication of the rails_admin application. Whenever I login with a valid username and password, I always got redirected to the users/sign_in action. Looking at the logs I can clearly see that the user's session is ok after the login, but I see that after the redirection to http://localhost:3000/app/, the current_user becomes null. Example of relevant log:
As you can see, I print the current_user.inspect as a before_action of ApplicationController, the rows starting with "reject_locked", after the actual login it states
reject_locked #<User:0x00007f0d2ce4c128>
after the unauthorized 401, the line just statesreject_locked
. Maybe this is normal, since comes after a 401 Unathorized, but the bug is here: why it throws an Unauthorized but the sign_in is ok?Reproduction steps
Enable by uncomment the Devise part in the rails_admin.rb initializer. then
rails s
Sign In and the problem is there.Expected behavior The current_user must be there also after the succesfull login in the Rails Admin routes.
Additional context
rails
version: 7.0.4.2rails_admin
version: 3.1.1devise
version: 4.8.1