ReviseAuth
A pure Ruby on Rails authentication system like Devise.
Installation
Add this line to your application's Gemfile:
bundle add "revise_auth"
And then execute the following to generate a User
model (optionally adding other fields such as first_name
and last_name
):
$ rails g revise_auth:model User first_name last_name
$ rails db:migrate
Usage
ReviseAuth is designed around a single User
model.
Roles / Other User Types
ReviseAuth only works with a single model to keep things simple. We recommend adding roles to handle other types of users.
You can accomplish this in a few different ways:
- A
roles
attribute on theUser
model - The Rolify gem
Customizing
To customize views, you can run:
$ rails g revise_auth:views
This will copy the views into app/views/revise_auth
in your application.
After Login Path
After a user logs in they will be redirected to the stashed location or the root path, by default. When a GET request hits authenticate_user!
, it will stash the request path in the session and redirect back after login.
To override this, define after_login_path
in your ApplicationController. You can also override ReviseAuthController
and define it there.
class ApplicationController < ActionController::Base
def after_login_path
root_path
end
end
Contributing
If you have an issue you'd like to submit, please do so using the issue tracker in GitHub. In order for us to help you in the best way possible, please be as detailed as you can.
If you'd like to open a PR please make sure the following things pass:
bin/rails db:test:prepare
bin/rails test
bundle exec standardrb
License
The gem is available as open source under the terms of the MIT License.