Skip to content
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

Number of digits are not consistent #33

Closed
shivanibhanwal opened this issue Aug 22, 2014 · 3 comments
Closed

Number of digits are not consistent #33

shivanibhanwal opened this issue Aug 22, 2014 · 3 comments

Comments

@shivanibhanwal
Copy link

Hi I am using "active_model_otp" gem and that uses internally "rotp" gem. As per the active_model_otp gem default code it should be generating 6 digit code. While I am doing extensive testing, I that found many times 3 or 4 digit code is getting generated.
And then it fails in VERIFY section. It is causing alot of trouble. Infact the developer of active_model_otp has also implemented PADDING by default but still it is not doing any padding and I am still getting 3 digit code.

For reference here is the link where I have posted question on active_model_otp
heapsource/active_model_otp#12

https://github.com/heapsource/active_model_otp/blob/4ec7c5686211be6cf9a08dc022c69ca7eddf077a/lib/active_model/one_time_password.rb#L24

https://github.com/heapsource/active_model_otp/blob/4ec7c5686211be6cf9a08dc022c69ca7eddf077a/lib/active_model/one_time_password.rb#L41

Thanks
Shivani

@shivanibhanwal shivanibhanwal changed the title Number of digit are not consistent Number of digits are not consistent Aug 22, 2014
@mdp
Copy link
Owner

mdp commented Aug 22, 2014

Hey Shivani,

Not sure what could be happening here. Do you have any example code where it's showing this behavior?

I wrote up a quick test and didn't see any delivered without the padding.
https://gist.github.com/2bb96f80f2d845354e90

Is it possible ActiveRecord is converting it to an integer?

Thanks

@shivanibhanwal
Copy link
Author

Hi Mark

I do not have example code for it. But it is mostly same as what is shown on the ActiveModel_otp gem.
I think you might be right about the Activerecord conversion. I will debug that gem and see what is happening before and after the activerecord call.

Thank you will update once I will get something.

@shivanibhanwal
Copy link
Author

@mdp You were right it was due to dataType of the table. As I had it as integer and that was causing this issue in the padding. Thanks for the help!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants