devise_masquerade icon indicating copy to clipboard operation
devise_masquerade copied to clipboard

Different Layouts

Open TimBoing opened this issue 2 years ago • 1 comments

  • I am masquerading the User model with an Admin model
  • I skip_before_action the authenticate_admin! method for the user app side
  • I am using different layouts for admin side and user app side
  • My buttons with the masquerade_path are located on the admin side
  • It seems that having different layouts have the effect to trigger twice the masquerades#show, juste after button click and after rendering the user layout (turbolinks?)
  • The first time everything works fine but the second time "authenticate_scope!" raises an error because the admin cannot be found anymore
  • My current solution: I added "return if user_masquerade?" in the authenticate_scope! method
  • Am I doing something wrong? Should "return if user_masquerade?" be added to your default "authenticate_scope!" method?

TimBoing avatar May 29 '23 10:05 TimBoing

Hi @TimBoing

Thank you for reporting the issue but at the same time it's pretty d to reproduce your flow. would it be possible for you to make the short demo in the public repo to debug the issue? the other solution you can fork the gem and check out the dummy app in spec/.

it's having a similar project that you described but without layouts, probably you can PR-only dummy app changes with layouts and I can pick it up to debug.

Thank you!

oivoodoo avatar May 29 '23 10:05 oivoodoo