Skip to main content
Spree allows you to use a different model for the admin panel than the storefront (that’s the default since Spree 5.2). Here you can find how to customize the admin panel authentication to use a different model. Let’s assume you have an existing AdminUser model in your application and you’re using Devise for authentication. In config/initializers/spree.rb file, add the following line:
This will tell Spree to use your AdminUser model for the admin panel. You will also need to add the following line in that model file:
In your config/initializers/routes.rb file, you will need to define devise routes for the 2nd model:
And now in your lib/spree/authentication_helpers.rb file, please replace the following lines:
Now when attempting to access the admin panel, you will be redirected to the dedicated admin panel login page. Admin panel login page