AlchemyCMS has no authentication in its core. So it is possible to bring your own authentication and use it to authorize users in AlchemyCMS. If you don't have your own authentication, you can use this gem.
Since Alchemy CMS 9.0, alchemy-devise is developed inside the Alchemy CMS repository
and released together with alchemy_cms using the same version.
Older versions are maintained in the alchemy-devise repository.
Just put the gem into your projects Gemfile.
# Gemfile
gem 'alchemy-devise'and run bundle install.
Then run the installer:
$ bin/rails g alchemy:devise:installAfter updating the gem, please run the installer again.
$ bundle update alchemy-devise
$ bin/rails g alchemy:devise:installDefault Devise modules included in Alchemy::User model
:database_authenticatable:trackable:validatable:timeoutable:recoverable:rememberable
If you want to add additional modules into the Alchemy user class append them to Alchemy::Devise.config.devise_modules in an initializer in your app.
# config/initializers/alchemy.rb
Alchemy::Devise.config.devise_modules << :registerableIf your app uses an old encryption that needs the +devise-encryptable+ gem you also need to load the devise module.
# config/initializers/alchemy.rb
Alchemy::Devise.config.devise_modules << :encryptableGranting or revoking the admin role asks the admin performing the change to
confirm their own password, both when creating a user and when editing one.
Since admin is the only role that can manage users, every other role and
every other user attribute can be edited with a valid session alone.
Roles that need a password are configurable:
# config/initializers/alchemy.rb
Alchemy::Devise.config.privileged_user_roles << "editor"Set this to false to grant roles with a valid session alone:
# config/initializers/alchemy.rb
Alchemy::Devise.config.require_password_for_role_change = falseIf you want to contribute (and you should ^_^), you need to run the tests locally on your machine.
The gem shares the bundle and the dummy app of the Alchemy CMS repository, so prepare the test database from the repository root.
The dummy app only loads alchemy-devise for these specs, because the Alchemy CMS specs use a stub user instead,
so bin/rspec runs them from the devise directory, separately from the Alchemy CMS specs.
$ bundle install
$ bundle exec rake alchemy:test:prepare$ bin/rspec devise/spec- If you have bugs, please use the issue tracker on Github.
- For Q&A and general usage, please use the Slack
- Homepage: https://alchemy-cms.com
- Live-Demo: https://alchemy-demo.herokuapp.com (user: demo, password: demo123)
- Issue-Tracker: https://github.com/AlchemyCMS/alchemy_cms/issues
- Sourcecode: https://github.com/AlchemyCMS/alchemy_cms/tree/main/devise
- Slack: https://slackin.alchemy-cms.com
- BSD: LICENSE