django-two-factor-auth icon indicating copy to clipboard operation
django-two-factor-auth copied to clipboard

Question : Totp tolerance change

Open PriyatamNayak opened this issue 2 years ago • 5 comments

Hi , Want to make the TOTP tolerance value to 0, to make sure the current token is only valid. Any setting is there to change the tolerance value for all users? need help

PriyatamNayak avatar Apr 13 '23 15:04 PriyatamNayak

I have no idea why you're tagging me. Please don't do that, it's rude. I'm not your personal support assistant.

matthiask avatar Apr 13 '23 15:04 matthiask

same as above + I don't even know what are you talking about.

vishalpandeynits avatar Apr 13 '23 16:04 vishalpandeynits

@vishalpandeyvip

https://django-two-factor-auth.readthedocs.io/en/stable/class-reference.html?highlight=tolerance#django_otp.plugins.otp_totp.models.TOTPDevice

Am asking , do you have any idea to change the value of the tolerance value for TOTP device which is default 1. Is there any seating to modify it for all users ?

FYI

key CharField: A hex-encoded secret key of up to 40 bytes. (Default: 20 random bytes)

step PositiveSmallIntegerField: The time step in seconds. (Default: 30)

t0 BigIntegerField: The Unix time at which to begin counting steps. (Default: 0)

digits PositiveSmallIntegerField: The number of digits to expect in a token (6 or 8). (Default: 6)

tolerance PositiveSmallIntegerField: The number of time steps in the past or future to allow. For example, if this is 1, we’ll accept any of three tokens: the current one, the previous one, and the next one. (Default: 1)

PriyatamNayak avatar Apr 14 '23 15:04 PriyatamNayak

You already have done enough research. you can just use the Model Class mentioned, and pass the value of tolerance whatever you want. pass it as an argument. For Example :

from django_otp.plugins.otp_totp import TOTPDevice
variable =  TOTPDevice.objects.create(tolerance=10)

vishalpandeynits avatar Apr 14 '23 18:04 vishalpandeynits

Am asking any global setting to change it to 0,for all users ?

PriyatamNayak avatar Apr 19 '23 00:04 PriyatamNayak