Skip to content

Commit

Permalink
use callback
Browse files Browse the repository at this point in the history
  • Loading branch information
alkesh committed Aug 5, 2024
1 parent 32ee695 commit cb1e215
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/controllers/claims_form_callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ def postcode_search_after_form_save_failure
end
end

def consent_before_show
if page_sequence.magic_link?
otp = OneTimePassword::Validator.new(params[:code], answers.sent_one_time_password_at)
if otp.valid? # && EligibleEyProvider.eligible_email?(answers.email_address) # TODO eligible check once model merged: https://github.com/DFE-Digital/claim-additional-payments-for-teaching/pull/3050
answers.assign_attributes(email_verified: true)
journey_session.save!
session[:slugs] << page_sequence.next_required_slug
end
end
end

private

def set_backlink_override_to_current_slug
Expand Down

0 comments on commit cb1e215

Please sign in to comment.