-
Notifications
You must be signed in to change notification settings - Fork 16
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
support validating OTP without a generated_at time and with a specified secret #3059
Conversation
4b46af8
to
3aa13dc
Compare
end | ||
|
||
private | ||
|
||
attr_reader :code, :generated_at | ||
|
||
def wrong_length? | ||
return @wrong_length if defined?(@wrong_length) | ||
|
||
@wrong_length = code.gsub(/\D/, "").length != LENGTH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this was ever doing - ignoring non-digits when checking for length doesn't seem useful.
e.g. code "1234A5B6" would have the correct length in this case, but would still not be a valid code (it still fails the ROTP:TOTP#verify
)
3aa13dc
to
a5c7cfe
Compare
a5c7cfe
to
1126e06
Compare
c5a07b5
to
30200c9
Compare
let!(:one_time_passcode) { OneTimePassword::Generator.new.code } | ||
let!(:generated_at) { Time.now } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not blocking but don't see why these can't be lazy ie let
instead of let!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because I have a spec that uses travel
to move 20 minutes into the future, to test for passcode expiry.
30200c9
to
a007cdf
Compare
a007cdf
to
65c5481
Compare
We need 2 changes to the OTP code for the EY magic link:
generated_at
time.