Browse Source

Return 422 if OTP auth is unsuccessful

pull/270/head
baarkerlounger 3 years ago
parent
commit
cf2ac1c964
  1. 4
      Gemfile.lock
  2. 8
      app/views/devise/two_factor_authentication/show.html.erb
  3. 2
      spec/features/admin_panel_spec.rb

4
Gemfile.lock

@ -20,7 +20,7 @@ GIT
GIT
remote: https://github.com/baarkerlounger/two_factor_authentication.git
revision: a7522becd7222f1aa4ddf73d7caf19f05bdb4dac
revision: 025d0a39ae971798402a7cefbd677cb15aa4983c
specs:
two_factor_authentication (2.2.0)
devise
@ -117,7 +117,7 @@ GEM
ast (2.4.2)
aws-eventstream (1.2.0)
aws-partitions (1.551.0)
aws-sdk-core (3.125.5)
aws-sdk-core (3.125.6)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)

8
app/views/devise/two_factor_authentication/show.html.erb

@ -11,10 +11,10 @@
<p class="govuk-body">We’ve sent you a text message with a security code.</p>
<%= f.govuk_number_field :code,
label: { text: "Security code" },
width: 5,
autocomplete: 'one-time-code',
autofocus: true
label: { text: "Security code" },
width: 5,
autocomplete: 'one-time-code',
autofocus: true
%>
<%= f.govuk_submit "Submit" %>

2
spec/features/admin_panel_spec.rb

@ -37,6 +37,7 @@ RSpec.describe "Admin Panel" do
fill_in("code", with: otp)
click_button("Submit")
expect(page).to have_content("Check your phone")
expect(page).to have_http_status(:unprocessable_entity)
end
end
end
@ -50,6 +51,7 @@ RSpec.describe "Admin Panel" do
fill_in("code", with: otp)
click_button("Submit")
expect(page).to have_content("Check your phone")
expect(page).to have_http_status(:unprocessable_entity)
end
end

Loading…
Cancel
Save