{"id":13878289,"url":"https://github.com/excid3/revise_auth","last_synced_at":"2025-10-08T18:28:52.736Z","repository":{"id":65215244,"uuid":"588200472","full_name":"excid3/revise_auth","owner":"excid3","description":"A pure Rails authentication system like Devise.","archived":false,"fork":false,"pushed_at":"2025-03-21T23:25:56.000Z","size":334,"stargazers_count":407,"open_issues_count":7,"forks_count":31,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-13T16:08:44.247Z","etag":null,"topics":["authentication","rails","ruby","rubyonrails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/excid3.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["excid3"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-01-12T15:06:55.000Z","updated_at":"2025-04-12T16:37:35.000Z","dependencies_parsed_at":"2024-03-08T16:50:43.296Z","dependency_job_id":"b36fe646-073d-48b2-bcce-c66b9cf364bf","html_url":"https://github.com/excid3/revise_auth","commit_stats":{"total_commits":147,"total_committers":22,"mean_commits":6.681818181818182,"dds":0.4965986394557823,"last_synced_commit":"96e966f47fa8d4835efb5242c7336401ae428573"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excid3%2Frevise_auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excid3%2Frevise_auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excid3%2Frevise_auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excid3%2Frevise_auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/excid3","download_url":"https://codeload.github.com/excid3/revise_auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741205,"owners_count":21154255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","rails","ruby","rubyonrails"],"created_at":"2024-08-06T08:01:45.283Z","updated_at":"2025-10-08T18:28:47.689Z","avatar_url":"https://github.com/excid3.png","language":"Ruby","funding_links":["https://github.com/sponsors/excid3"],"categories":["Ruby"],"sub_categories":[],"readme":"# ReviseAuth\n\n[![Gem Version](https://badge.fury.io/rb/revise_auth.svg)](https://badge.fury.io/rb/revise_auth)\n\nA pure Ruby on Rails authentication system like Devise.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"revise_auth\"\n```\n\nand then run `bundle install`.\n\nOr run this command:\n\n```bash\nbundle add \"revise_auth\"\n```\n\n## Usage\n\n### Models\n\nReviseAuth is designed around a single `User` model. Execute the following to generate the `User` model:\n\n```bash\n$ rails g revise_auth:model\n```\n\nOptionally, you can add other fields such as `first_name` and `last_name`:\n\n```bash\n$ rails g revise_auth:model first_name last_name\n```\n\nAnd then run:\n\n```bash\n$ rails db:migrate\n```\n\n#### Roles / Other User Types\n\nReviseAuth only works with a single model to keep things simple. We recommend adding roles to handle other types of users.\n\nYou can accomplish this in a few different ways:\n\n* A `roles` attribute on the `User` model\n* The Rolify gem\n\n### Routes\n\nThe model generator will automatically add ReviseAuth's routes to your router:\n\n```\n# config/routes.rb\n\nrevise_auth\n```\n\nYou will want to define a root path. After login (see below), the user will be redirected to the root path.\n\n### Views\n\nReviseAuth uses the flash to display notices and alerts, so make sure flash messages are rendered by your application:\n\n```erb\n\u003c%# views/layouts/application.html.erb %\u003e\n\n\u003c%= tag.div notice if notice %\u003e\n\u003c%= tag.div alert if alert %\u003e\n```\n\n### Filters and Helpers\n\nTo protect your actions from unauthenticated users, you can use the `authenticate_user!` filter:\n\n```ruby\nbefore_action :authenticate_user!\n```\n\nIn your views, you can use `user_signed_in?` to verify if a user is signed in and `current_user` for using the signed in user.\n\n### Mailer\n\nReviseAuth will send some emails:\n\n* password reset\n* confirmation instructions\n\nMake sure you have the default url options set:\n\n```ruby\n# in config/environments/development.rb\nconfig.action_mailer.default_url_options = {host: \"localhost\", port: 3000}\n```\n\nNote: This should be set in all environments.\n\n## Customizing\n\nTo customize views, you can run:\n\n```bash\n$ rails g revise_auth:views\n```\n\nThis will copy the views into `app/views/revise_auth` in your application.\n\n### Form Permitted Params\n\nTo customize the form parameters, you can add/remove params in `config/initializers/revise_auth.rb`\n\n```ruby\nReviseAuth.configure do |config|\n  config.sign_up_params += [:time_zone]\n  config.update_params += [:time_zone]\nend\n```\n\n### After Login Path\n\nAfter 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.\n\nTo override this, define `after_login_path` in your `ApplicationController`. You can also override `ReviseAuthController` and define it there.\n\n```ruby\nclass ApplicationController \u003c ActionController::Base\n  def after_login_path\n    root_path\n  end\nend\n```\n\n### Routing Constraints\n\nYou can use any of the authentication functionality in your routes using the `ReviseAuth::RouteConstraint` class.\n\nThe following will draw routes only if the user is signed in:\n\n```ruby\nauthenticated -\u003e{ _1.admin? } do\n  resource :admin\nend\n\nauthenticated do\n  resource :dashboard\nend\n```\n\n### Password Length\n\nThe minimum acceptable password length for validation defaults to 12 characters but this can be configured in either `config/initializers/revise_auth.rb` or your environment configuration:\n\n```ruby\nReviseAuth.configure do |config|\n  config.minimum_password_length = 42\nend\n```\n\n## Test helpers\n\nReviseAuth comes with handy helpers you can use in your tests:\n\n```ruby\n# POST /login with the given user and password\nlogin(user, password: \"password\")\n# DELETE /logout\nlogout\n```\n\nInclude the `ReviseAuth::Test::Helpers` module to make them available in your tests.\n\n```ruby\nclass ActionDispatch::IntegrationTest\n  include ReviseAuth::Test::Helpers\nend\n```\n\nThen in your tests:\n\n```ruby\nclass MyControllerTest \u003c ActionDispatch::IntegrationTest\n  setup do\n    @user = users(:bob)\n    login @user\n  end\n\n  test \"...\" do\n    # ...\n  end\nend\n```\n\n## Contributing\n\nIf 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.\n\nIf you'd like to open a PR please make sure the following things pass:\n\n```bash\nbin/rails db:test:prepare\nbin/rails test\nbundle exec standardrb\n```\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexcid3%2Frevise_auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexcid3%2Frevise_auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexcid3%2Frevise_auth/lists"}