Hi, I'm using this gem to generate OTP for User. As specified in the documentation I've provided the length attribute as 4. But still the OTP being generated is more than 4 characters.
Below is my code snippet :
`class User < ActiveRecord::Base
Include default devise modules. Others available are:
:confirmable, :lockable, :timeoutable and :omniauthable
def generate_authentication_token!
begin
self.auth_token = Devise.friendly_token
puts self.auth_token
end while self.class.exists?(auth_token: auth_token)
end
end`
Can someone tell if possibly I'm going wrong somewhere?
Hi, I'm using this gem to generate OTP for User. As specified in the documentation I've provided the length attribute as 4. But still the OTP being generated is more than 4 characters. Below is my code snippet :
`class User < ActiveRecord::Base
Include default devise modules. Others available are:
:confirmable, :lockable, :timeoutable and :omniauthable
has_one :user_detail has_many :products has_one_time_password length: 4 before_create :generate_authentication_token!
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
accepts_nested_attributes_for :user_detail
def generate_authentication_token! begin self.auth_token = Devise.friendly_token puts self.auth_token end while self.class.exists?(auth_token: auth_token) end
end`
Can someone tell if possibly I'm going wrong somewhere?