Skip to content

iprog21/iprog_otp_generator

Repository files navigation

Iprog OTP Code Generator

IPROG TECH

This gem is provided by IPROG TECH, an information technology company specializing in web development services using Ruby on Rails. IPROG TECH also offers free programming tutorials.

Providing Good Quality Web Services:

  • Startup
  • Maintenance
  • Upgrading & Conversion

Buy Me A Coffee

Installation

To install the gem, add this line to your application's Gemfile:

gem 'iprog_otp_generator'

And then execute:

$ bundle install

Or initialize and install

$ bundle add iprog_otp_generator

Or install it yourself as:

$ gem install iprog_otp_generator

Generate Migration File

$ rails generate iprog_otp_generator:install MODEL

Run migration

$ rails db:migrate

Initialization

app/models/user.rb

class User < ApplicationRecord
 enable_otp
end

Usage

Generate new OTP Code

user = User.take
user.generate_otp_code

or 

user.generate_otp_code(10)

default length parameter: 8


Validate OTP Code

user = User.take
code = 12351234

user.valid_otp_code?(code)

Reset OTP Code

user = User.take

user.clear_otp_code

Rspec Testing

Run Spec:

$ rspec spec/iprog_otp_generator_spec.rb

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/iprog21/iprog_otp_generator.

License

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

Code of Conduct

This project has adopted the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages