-
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
The option auto_increment (for ActiveModel::OneTimePassword#authenticate_code/otp_code) is not working #58
Comments
auto_increment
(for ActiveModel::OneTimePassword#authenticate_code/otp_code
) is not working
gbp
added a commit
to mysociety/alaveteli
that referenced
this issue
Feb 3, 2021
Since upgrading to active_model_otp 2.1.0 specs for updating password have been broken. This is due a bug being fixed upstream [1]. This has resulted in the user record being saved an additional time [2]. We call `authenticate_otp` within a validate callback it means it's also called an additional time. This second call then fails due to the `entered_otp_code` is set to nil in the initial validation callback. This adds an error to the user prevents the controller from following the expected successful redirection. This change prevents additional save from being triggered upstream and instead we manually increment the `otp_counter` which is saved after validation is complete. [1] heapsource/active_model_otp#58 [2] https://github.com/heapsource/active_model_otp/blob/v2.1.0/lib/active_model/one_time_password.rb#L52
gbp
added a commit
to mysociety/alaveteli
that referenced
this issue
Feb 16, 2021
Since upgrading to active_model_otp 2.1.0 specs for updating password have been broken. This is due a bug being fixed upstream [1]. This has resulted in the user record being saved an additional time [2]. We call `authenticate_otp` within a validate callback it means it's also called an additional time. This second call then fails due to the `entered_otp_code` is set to nil in the initial validation callback. This adds an error to the user prevents the controller from following the expected successful redirection. This change prevents additional save from being triggered upstream and instead we manually increment the `otp_counter` which is saved after validation is complete. [1] heapsource/active_model_otp#58 [2] https://github.com/heapsource/active_model_otp/blob/v2.1.0/lib/active_model/one_time_password.rb#L52
gbp
added a commit
to mysociety/alaveteli
that referenced
this issue
Mar 8, 2021
Since upgrading to active_model_otp 2.1.0 specs for updating password have been broken. This is due a bug being fixed upstream [1]. This has resulted in the user record being saved an additional time [2]. We call `authenticate_otp` within a validate callback it means it's also called an additional time. This second call then fails due to the `entered_otp_code` is set to nil in the initial validation callback. This adds an error to the user prevents the controller from following the expected successful redirection. This change prevents additional save from being triggered upstream and instead we manually increment the `otp_counter` which is saved after validation is complete. [1] heapsource/active_model_otp#58 [2] https://github.com/heapsource/active_model_otp/blob/v2.1.0/lib/active_model/one_time_password.rb#L52
gbp
added a commit
to mysociety/alaveteli
that referenced
this issue
Apr 14, 2021
Since upgrading to active_model_otp 2.1.0 specs for updating password have been broken. This is due a bug being fixed upstream [1]. This has resulted in the user record being saved an additional time [2]. We call `authenticate_otp` within a validate callback it means it's also called an additional time. This second call then fails due to the `entered_otp_code` is set to nil in the initial validation callback. This adds an error to the user prevents the controller from following the expected successful redirection. This change prevents additional save from being triggered upstream and instead we manually increment the `otp_counter` which is saved after validation is complete. [1] heapsource/active_model_otp#58 [2] https://github.com/heapsource/active_model_otp/blob/v2.1.0/lib/active_model/one_time_password.rb#L52
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since instances of
ActiveRecord::Persistence
have a method#new_record?
not#new_record
active_model_otp/lib/active_model/one_time_password.rb
Line 52 in 3280ecd
active_model_otp/lib/active_model/one_time_password.rb
Line 69 in 3280ecd
The text was updated successfully, but these errors were encountered: