oivoodoo / devise_masquerade

Extension for devise, enable login as functionality. Add link to the masquerade_path(resource) and use it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different Layouts

TimBoing opened this issue · 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?
commented

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!