Coder Social home page Coder Social logo

devise_sms_activable's Introduction

devise_sms_activable

Devise Sms Activable is a snap-in for Devise that will make any resource activable via SMS. The user will receive an SMS with a token that can be entered on the site to activate the account. Ask the user his phone (and phone confirmation to double check) on registration and the token will be sended automagically.

Installation for Rails ~> 3.0 and Devise ~> 1.1

Install DeviseSmsActivable gem, it will also install dependencies (such as devise and warden):

gem install devise_sms_activable

Add DeviseSmsActivable to your Gemfile (and Devise if you weren’t using them):

gem 'devise',           '>= 1.1.0'
gem 'devise_sms_activable', '~> 0.0.9'

Automatic installation

Run the following generator to add DeviseSmsActivable’s configuration option in the Devise configuration file (config/initializers/devise.rb) and the sms sender class in your lib folder:

rails generate devise_sms_activable:install

When you are done, you are ready to add DeviseSmsActivable to any of your Devise models using the following generator:

rails generate devise_sms_activable MODEL

Replace MODEL by the class name you want to add DeviseSmsActivable, like User, Admin, etc. This will add the :sms_activable flag to your model’s Devise modules. The generator will also create a migration file (if your ORM support them). Continue reading this file to understand exactly what the generator produces and how to use it.

Configuring views

All the views are packaged inside the gem. If you’d like to customize the views, invoke the following generator and it will copy all the views to your application:

rails generate devise_sms_activable:views

You can also use the generator to generate scoped views:

rails generate devise_sms_activable:views users

Please refer to Devise’s README for more information about views.

Usage

The model is specular to the Devise’s own Confirmable model. It only requires the user to supply a valid phone number.

On registration it will send an SMS with a token to be inserted to complete activation process. By default users MUST activate by SMS before entering. If you want something more “relaxed” just override sms_confirmation_required? in your model and make it your way. You can use the convenience filter require_sms_activated! in your controller to block sms-unactive users from specific pages.

Controller filter

DeviseSmsActivable extends your controllers with a require_sms_activated! method. Use it to restrict part of the site to “confirmed users” only

I18n

DeviseSmsActivable installs a localizable file in your config/locales folder.

Contributing to devise_sms_activable

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Stefano Valicchia. See LICENSE.txt for further details.

devise_sms_activable's People

Contributors

giano avatar shahin70000 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.