-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to generate 4 digit code? #12
Comments
@shivanibhanwal currently there's not way to specified a length for the code generated, but is something that we can add look https://github.com/mdp/rotp/blob/master/lib/rotp/otp.rb#L14 and would looks like: class User < ActiveRecord::Base
has_one_time_password length: 4
end about your second question, could you paste some code in order to repreduce the issue?. for me is working good |
Thank you @robertomiranda ! yes I think that would really help as most of the time people use 4 or 6 digit code for OTP
|
About the other issue I see code is there in the gem files.
and this time I got it 3 digit
Its happening verify frequently |
@robertomiranda About my second query, Issue was the DataType of the "otp_code" field. I was having it as integer and that was trimming these zero paddings. |
@shivanibhanwal for sure, I'll take a look 👍, but please open the Pull request anyway this can help us to keep and track better the discussion. |
Sure |
Hi @robertomiranda,
Thank you for the nice gem. It is really helpful for the OTP generation.
I am using it in my project however we have requirement of 4 digit otp code instead of 6 digit.
Would like to know is there a way to customise it to make it 4 digit or any number of digit?
Another question about Padding a otp code. I have seen that one of the issue has been closed and there has been a pull request. However I am using active_model_otp (1.0.0) version in my project. But still I am getting 5 digit digit some times randomly. And also I did not set any "padding: false"
Is that change related to padding has been published ?
Thanks
Shivani
The text was updated successfully, but these errors were encountered: