Comments (10)
@aelor currently you can implement this passing the drift
parameter to the authenticate_otp
method, for you case should be looks like:
user.authenticate_otp('186522') # => true
sleep 60 # lets wait
user.authenticate_otp('186522', drift: 120) # => true
sleep 60 # lets wait
user.authenticate_otp('186522', drift: 120) # => true
this behavior is described in the Readme
from active_model_otp.
@robertomiranda so when i will use this
user.authenticate_otp('186522', drift: 120)
then this will make the OTP(186522) valid for 120 seconds ?
from active_model_otp.
@anshulklr exactly!
from active_model_otp.
@robertomiranda thanks
from active_model_otp.
Hello i want to know that how do i use it? and can make it more than 12 hours? every 5 minutes it will increase more 5 minutes.... how do i do it?
from active_model_otp.
@masumrock I think making it valid for 12 hours is as simple as converting 12hrs to 12_60_60seconds and then use the drift with 43200(12_60_60)
In your code to authenticate the otp
user.authenticate_otp('232322', drift: 43200)
from active_model_otp.
actually i don't know how to use this code... i am using it to console in (Firebug)
from active_model_otp.
@masumrock This code is done server side, not the client side. Its ruby NOT javascript.
from active_model_otp.
does it possible into java script? i want to use it in a website... which provide otp system... i want extend the otp validation 5 minutes to 12 hours.....is there any way?
from active_model_otp.
@masumrock Well see, what you can do is write your own code for sending the otp and not use this gem. Whenever the user enters his mobile number, send an ajax to send the otp to his phone and save the phonenumber in the localstorage along with the expiry time (current time + 12hours), then keep checking if the current time has crossed that value. But I will not recommend this because it is vulnerable to be easily tampered by the users. They will be able to change the expiry time in the localstorage.
from active_model_otp.
Related Issues (20)
- Security vulnerability: backup codes are stored as plain text HOT 1
- Does this work with Sinatra HOT 1
- Release new version of the gem HOT 2
- last_otp_at misbehaving HOT 4
- "Preventing reuse of Time based OTP's" not working HOT 1
- undefined method `dark?' for #<RQRCode::QRCode:0x00005649dee622a0
- BCrypt::Errors::InvalidHash
- Preventing reuse of Time based OTP's README clarification?
- Allow rotp update to 6.3.0 to fix CVE-2024-28862 HOT 5
- undefined method `dark?' when creating QR-Code HOT 2
- Recovery Backup Codes HOT 2
- Enable/disable generate opt_secret_key when is an user is created HOT 2
- Plans to release a new version? HOT 5
- 2 bugs in provisioning_uri for HOTP tokens HOT 3
- Error: "NoMethodError (undefined method `before_create' for {}:Hash)" when used with devise on ruby 3.0.0 HOT 5
- Release of a version with Ruby 3 support HOT 2
- TOTP Server
- authenticate_otp (counter_based) now returns the corresponding otp_counter or nil instead of a boolean value HOT 1
- Token with empty string return true on authenticate_otp HOT 2
- one_time_backup_codes not working as expected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from active_model_otp.