heapsource / active_model_otp

Adds methods to set and authenticate against one time passwords (Two-Factor Authentication). Inspired in AM::SecurePassword
MIT License
769 stars 81 forks source link

Added Counter based OTP (HOTP) #19

Closed ghost closed 9 years ago

ghost commented 9 years ago

For my project I required a counter based solution. I've expanded this to support the counter_based flag to allow HOTP. It's been tested in my environment and is working as expected. Readme has been updated with usage instructions as well as the version number increase to v1.2.0.

Let me know if this is all good and if you want me to perform any other changes before pulling. Thanks!

robertomiranda commented 9 years ago

@ResultsMayVary thanks I'll check it during the weekend, in the mean time could you apply the changes suggested by @houndci?

ghost commented 9 years ago

Of course. I was just reviewing them. Do you have a recommendation for the comments regarding lines being too long when it's coded the same as other lines?

robertomiranda commented 9 years ago

sure, follow this ruby style guide https://github.com/bbatsov/ruby-style-guide#no-double-indent

robertomiranda commented 9 years ago

btw, we should add that ruby style to the contributors guideline :grin:

ghost commented 9 years ago

I've fixed as many of the issues as I can. At this point what do I do about the redundant self issues? Not worry about them? If I don't access otp_counter as self it returns as false:FalseClass.

robertomiranda commented 9 years ago

@ResultsMayVary sure, it doesn't matter

robertomiranda commented 9 years ago

@ResultsMayVary all looks good for me, but I'd like to have another opinion @guilleiguaran could you check it?

robertomiranda commented 9 years ago

@ResultsMayVary thanks :+1:

ghost commented 9 years ago

@robertomiranda welcome! I did the changes for work so I always contribute back when I can.