Closed aelor closed 9 years ago
@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
@robertomiranda so when i will use this user.authenticate_otp('186522', drift: 120) then this will make the OTP(186522) valid for 120 seconds ?
@anshulklr exactly!
@robertomiranda thanks
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?
@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)
actually i don't know how to use this code... i am using it to console in (Firebug)
@masumrock This code is done server side, not the client side. Its ruby NOT javascript.
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?
@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.
Hi, currently the validity of the OTP is set to 30 seconds. Is there a possibilty to increase the OTP time to say 2mins. I dont know if it is correct to be done. I tried searching the internet but couldn't find anything