GithubHelp home page GithubHelp logo

voyllatech / solidus_auth_devise Goto Github PK

View Code? Open in Web Editor NEW

This project forked from solidusio/solidus_auth_devise

0.0 1.0 0.0 726 KB

Adds devise authentication to solidus

License: BSD 3-Clause "New" or "Revised" License

Ruby 87.61% HTML 12.26% JavaScript 0.06% CSS 0.07%

solidus_auth_devise's Introduction

Solidus Auth (Devise)

Provides authentication services for Solidus, using the Devise gem.

Installation

Just add this line to your Gemfile:

gem "solidus_auth_devise"

Then run bundle install.

Confirmable

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 config/initializers/spree.rb):
Spree::Auth::Config[:confirmable] = true
  • Add a Devise initializer to your Rails project (typically config/initializers/devise.rb):
Devise.setup do |config|
  # Required so users don't lose their carts when they need to confirm.
  config.allow_unconfirmed_access_for = 1.days

  # Fixes the bug where Confirmation errors result in a broken page.
  config.router_name = :spree

  # 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 register_ability method.

First create your own CanCan Ability class following the CanCan documentation.

For example: app/models/super_abilities.rb

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

Spree::Ability.register_ability(SuperAbilities)

Inside of your host application you can then use CanCan like you normally would.

<% if can? :stop Bullet %>
  ...
<% end %>

Testing

Until Solidus is publicly available, the easiest way to satisfy the Solidus dependancy is with a local Bundler override:

bundle config local.spree /path/to/local/solidus/repository

Then just run the following to automatically build a dummy app if necessary and run the tests:

bundle exec rake

solidus_auth_devise's People

Contributors

radar avatar jhawthorn avatar huoxito avatar adammathys avatar futhr avatar brchristian avatar jordan-brough avatar jdutil avatar westonplatter avatar reinaris avatar petergoldstein avatar forkata avatar schof avatar sanemat avatar sbounmy avatar senjai avatar rterbush avatar peterberkenbosch avatar magnusvk avatar bdq avatar athal7 avatar geekoncoffee avatar trappist avatar laurens avatar kennyadsl avatar benmorganio avatar johanb avatar lbrapid avatar jhirbour avatar jschwertfeger avatar

Watchers

Devendra avatar

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.