Giter Site home page Giter Site logo

Comments (10)

robertomiranda avatar robertomiranda commented on June 4, 2024 1

@aelor currently you can implement this passing the drift parameter to the authenticate_otpmethod, 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.

anshulklr avatar anshulklr commented on June 4, 2024

@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.

robertomiranda avatar robertomiranda commented on June 4, 2024

@anshulklr exactly!

from active_model_otp.

anshulklr avatar anshulklr commented on June 4, 2024

@robertomiranda thanks

from active_model_otp.

masumrock avatar masumrock commented on June 4, 2024

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.

aelor avatar aelor commented on June 4, 2024

@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.

masumrock avatar masumrock commented on June 4, 2024

actually i don't know how to use this code... i am using it to console in (Firebug)

from active_model_otp.

aelor avatar aelor commented on June 4, 2024

@masumrock This code is done server side, not the client side. Its ruby NOT javascript.

from active_model_otp.

masumrock avatar masumrock commented on June 4, 2024

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.

aelor avatar aelor commented on June 4, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.