Replies: 1 comment 2 replies
-
Regarding the model mixin inclusion, your last suggestion should work, though rodauth-rails provides a shorthand, so include Rodauth::Model(RodauthApp.rodauth(:admin)) can be written as include Rodauth::Rails.model(:admin) The latter is documented in the README 😉 Regarding the Specifying it shouldn't hurt either, I'm not sure what breaks when you do it. Maybe a circular dependency issue, so using a block might fix it: rails_account_model { AdminAccount }
You might be encountering Rodauth resetting the session on login and logout, which logs out any other Rodauth configurations logged in (since it clears the whole session). This is pure Rodauth, so I recommend asking about this use case on that repo.
This also sounds like it's caused by the session being reset, invalidating the CSRF token in the original tab. AFAIK, Rodauth does this to prevent Session Fixation attacks. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'd love it if someone could help me clarify a few things.
I want to separate the user account from the admin account through different tables and models.
I created config in rodauth_app.rb
I created admin_account.rb model
It works with each type of include unless I add
rails_account_model AdminAccount
to rodauth_admin.rb (should I even add it?)rest of rodauth_admin.rb
My next question is shouldn't it be possible to be logged in to two accounts at the same time if they have separate session ids?
With single Account and account_type table approach if I log as Admin and then as User in same browser Admin account logout but I can at least log in again.
With multiple Account models (Account and AdminAccount) I can't even log in after User log in.
Do I need to change?
Another interesting behavior.
If I go to user/login form but I don't log in and go to admin/login in another tab and log in as admin.
Now if I go back to user/login and try to log in I got Can't verify CSRF token authenticity. error
Sorry for the bunch of questions. I think I'm missing something but I don't know what =(
Beta Was this translation helpful? Give feedback.
All reactions