Giter VIP home page Giter VIP logo

revise_auth's Introduction

ReviseAuth

Gem Version

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 the User 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

Routing Constraints

You can use any of the authentication functionality in your routes using the ReviseAuth::RouteConstraint class.

The following will draw routes only if the user is signed in:

authenticated ->{ _1.admin? } do
  resource :admin
end

authenticated do
  resource :dashboard
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.

revise_auth's People

Contributors

beyzaakyol avatar dependabot[bot] avatar dixpac avatar drale2k avatar excid3 avatar francocorreasosa avatar gathuku avatar gregmolnar avatar jakubschwar avatar julienitard avatar kylekeesling avatar robertchang0722 avatar sandroscosta avatar stefanos450 avatar tonksthebear avatar yorickvandervis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

revise_auth's Issues

Support password resets via email

Unless I'm missing something it doesn't look like password resets are supported yet.

If you'd like I'd be happy to submit a PR to support it via the same 'generates_token_for' API that I currently have an PR for email confirmations for.

Extensions

Are you planning to support optional extensions like locking accounts on brute-force attempts, sudo mode, etc?
I would be happy to help with those if there is an example of how you would like them to be implemented.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.