Browse Source

Add gov uk error summary if OTP code is invalid

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

2
Gemfile.lock

@ -20,7 +20,7 @@ GIT
GIT GIT
remote: https://github.com/baarkerlounger/two_factor_authentication.git remote: https://github.com/baarkerlounger/two_factor_authentication.git
revision: 025d0a39ae971798402a7cefbd677cb15aa4983c revision: 276a896d4f8f4186b199588f8b8900abb8b24a9a
specs: specs:
two_factor_authentication (2.2.0) two_factor_authentication (2.2.0)
devise devise

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

@ -1,8 +1,9 @@
<% content_for :title, "Check your phone" %> <% content_for :title, "Check your phone" %>
<%= form_with(url: "/admin/two-factor-authentication", html: { method: :put }) do |f| %> <%= form_with(model: resource, url: "/admin/two-factor-authentication", html: { method: :put }) do |f| %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %>
<h1 class="govuk-heading-l"> <h1 class="govuk-heading-l">
<%= content_for(:title) %> <%= content_for(:title) %>

2
app/views/layouts/application.html.erb

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="govuk-template"> <html lang="en" class="govuk-template">
<head> <head>
<title><%= browser_title(yield(:title), @user, @organisation, @case_log, @resource) %></title> <title><%= browser_title(yield(:title), @admin_user, @user, @organisation, @case_log, @resource) %></title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>
<%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %> <%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %>

4
spec/features/admin_panel_spec.rb

@ -38,6 +38,8 @@ RSpec.describe "Admin Panel" do
click_button("Submit") click_button("Submit")
expect(page).to have_content("Check your phone") expect(page).to have_content("Check your phone")
expect(page).to have_http_status(:unprocessable_entity) expect(page).to have_http_status(:unprocessable_entity)
expect(page).to have_title("Error")
expect(page).to have_selector("#error-summary-title")
end end
end end
end end
@ -52,6 +54,8 @@ RSpec.describe "Admin Panel" do
click_button("Submit") click_button("Submit")
expect(page).to have_content("Check your phone") expect(page).to have_content("Check your phone")
expect(page).to have_http_status(:unprocessable_entity) expect(page).to have_http_status(:unprocessable_entity)
expect(page).to have_title("Error")
expect(page).to have_selector("#error-summary-title")
end end
end end

Loading…
Cancel
Save