Skip to content

Yoomee/pinfirmable

Repository files navigation

Pinfirmable

A replacement for Devise confirmable to use a pin rather than an emailed link to confirm a users email. (Inspired by Slack)

Installation

Add this line to your application's Gemfile:

gem 'pinfirmable'

And then execute:

$ bundle

Add the pinfirmable module to your devise model (e.g User)

class User < ApplicationRecord
  devise :database_authenticatable,
         :registerable,
         ...
         :pinfirmable
rake db:migrate
# If your devise model isn't called user
rake db:migrate MODEL=admin

Add the javascript include to the asset pipeline.

//= require pinfirmable

Skip Emails

To skip the pinfirmable email when creating a user (e.g. when seeding a database) the skip_pinfirmation! method is available

user = User.new
# setup the user
user.skip_pinfirmation!
user.save

Development set up

Check out the project and then run

rake db:setup

To create and migrate a development and test database.

Run rspec to run the tests.

Todo

  • Encrypt the pin in the DB

License

The gem is available as open source under the terms of the MIT License.