Solidus Auth Devise
Provides authentication services for Solidus, using the Devise gem.
Add solidus_auth_devise to your Gemfile:
After that's done, you can install and run the necessary migrations, then seed the database:
bundle exec rake solidus_auth:install:migrations bundle exec rake db:migrate bundle exec rake db:seed
As part of running the above installation steps, you will be asked to set an admin email/password combination. The default values are
To enable Devise's Confirmable module, which will send the user an email with a link to confirm their account, you must do the following:
- Add this line to an initializer in your Rails project (typically
Spree::Auth::Config[:confirmable] = true
- Add a Devise initializer to your Rails project (typically
Devise.setup do |config| # Required so users don't lose their carts when they need to confirm. config.allow_unconfirmed_access_for = 1.days # Add any other devise configurations here, as they will override the defaults provided by solidus_auth_devise. end
Using in an existing application
If you are installing Solidus inside of a host application in which you want your own permission setup, you can do this using the
First create your own CanCan Ability class following the CanCan documentation.
class SuperAbilities include CanCan::Ability def initialize user if user.is? "Superman" can :stop, Bullet end end end
Then register your class in your spree initializer: config/initializers/spree.rb
Inside of your host application you can then use CanCan like you normally would.
<% if can? :stop Bullet %> ... <% end %>
Testing the extension
First bundle your dependencies, then run
bin/rake will default to building the dummy
app if it does not exist, then it will run specs. The dummy app can be regenerated by using
To run Rubocop static code analysis run
bundle exec rubocop
When testing your application's integration with this extension you may use its factories.
Simply add this require statement to your
Or, if you are using
FactoryBot.definition_file_paths, you can load Solidus core
factories along with this extension's factories using this statement:
Running the sandbox
To run this extension in a sandboxed Solidus application, you can run
bin/sandbox. The path for
the sandbox app is
bin/rails will forward any Rails commands to
Here's an example:
$ bin/rails server => Booting Puma => Rails 22.214.171.124 application starting in development * Listening on tcp://127.0.0.1:3000 Use Ctrl-C to stop
Updating the changelog
Before and after releases the changelog should be updated to reflect the up-to-date status of the project:
bin/rake changelog git add CHANGELOG.md git commit -m "Update the changelog"
Releasing new versions
Please refer to the dedicated page on Solidus wiki.
Copyright (c) 2022 Solidus Team, released under the New BSD License.