Skip to content

Instantly share code, notes, and snippets.

@robertomiranda
Created July 11, 2013 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robertomiranda/31b8f8b1f69971611ad9 to your computer and use it in GitHub Desktop.
Save robertomiranda/31b8f8b1f69971611ad9 to your computer and use it in GitHub Desktop.
require "active_model_otp"
class User
extend ActiveModel::Callbacks
include ActiveModel::Validations
include ActiveModel::OneTimePassword
define_model_callbacks :create
attr_accessor :otp_secret_key, :email
has_one_time_password
end
user = User.new
user.email = 'roberto@heapsource.com'
user.otp_secret_key = "2z6hxkdwi3uvrnpn"
puts "Current code #{user.otp_code}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment