Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/assets/javascripts/assets.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ window.LoginGov.assets = {};

<% keys = [
'clock.svg',
'state-id-sample-front.jpg',
'plus.svg',
'minus.svg',
'up-carat-thin.svg',
Expand Down
42 changes: 15 additions & 27 deletions app/javascript/app/document-capture/components/document-capture.jsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,30 @@
import React, { useState } from 'react';
import AcuantCapture from './acuant-capture';
import DocumentTips from './document-tips';
import Image from './image';
import FormSteps from './form-steps';
import DocumentsStep, { isValid as isDocumentsStepValid } from './documents-step';
import Submission from './submission';

function DocumentCapture() {
const [formValues, setFormValues] = useState(null);

const sample = (
<Image
assetPath="state-id-sample-front.jpg"
alt="Sample front of state issued ID"
width={450}
height={338}
/>
);

return formValues ? (
<Submission payload={formValues} />
) : (
<>
<AcuantCapture />
<DocumentTips sample={sample} />
<FormSteps
steps={[
{
name: 'documents',
component: DocumentsStep,
isValid: isDocumentsStepValid,
},
{ name: 'selfie', component: () => 'Selfie' },
{ name: 'confirm', component: () => 'Confirm?' },
]}
onComplete={setFormValues}
/>
</>
<FormSteps
steps={[
{
name: 'documents',
component: DocumentsStep,
isValid: isDocumentsStepValid,
},
{
name: 'selfie',
component: AcuantCapture,
},
{ name: 'confirm', component: () => 'Confirm?' },
]}
onComplete={setFormValues}
/>
);
}

Expand Down
158 changes: 78 additions & 80 deletions app/views/idv/doc_auth/document_capture.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<% if Figaro.env.acuant_sdk_document_capture_enabled == 'true' %>
<% title t('doc_auth.titles.doc_auth') %>
<% content_for :meta_tags do %>
<meta
name="acuant-sdk-initialization-endpoint"
Expand All @@ -9,95 +10,92 @@
content="<%= Figaro.env.acuant_sdk_initialization_creds %>"
>
<% end %>
<div id="document-capture-form"></div>
<%= javascript_pack_tag 'document-capture' %>
<% end %>
<div>
<% title t('doc_auth.titles.doc_auth') %>

<%= render 'idv/doc_auth/error_messages', flow_session: flow_session %>
<div id="document-capture-form">
<%= render 'idv/doc_auth/error_messages', flow_session: flow_session %>

<h1>
<% if liveness_checking_enabled? %>
<%= t('doc_auth.headings.document_capture_with_selfie_html') %>
<% else %>
<%= t('doc_auth.headings.document_capture_html') %>
<% end %>
</h1>

<%= render 'idv/doc_auth/document_capture_notices', flow_session: flow_session %>

<%= simple_form_for(
:doc_auth,
url: url_for,
method: 'PUT',
html: { autocomplete: 'off', role: 'form', class: 'mt2' }
) do |f| %>
<%# ---- Front Image ----- %>

<hr class="mt3 mb3"/>
<div class="front-image">
<h2>
<%= t('doc_auth.headings.upload_front_html') %>
</h2>

<%= accordion('totp-info', t('doc_auth.tips.title_html'),
wrapper_css: 'my2 col-12 fs-16p') do %>
<%= render 'idv/doc_auth/tips_and_sample' %>
<div class='center'>
<%= image_tag(asset_url('state-id-sample-front.jpg'), height: 338, width: 450) %>
</div>
<% end %>

<%= f.input :front_image_data_url, as: :hidden %>
<%= f.input :front_image, label: false, as: :file, required: true, wrapper_class: 'mt3 sm-col-8' %>
<div class='my2' id='front_target'></div>
</div>

<h1>
<% if liveness_checking_enabled? %>
<%= t('doc_auth.headings.document_capture_with_selfie_html') %>
<% else %>
<%= t('doc_auth.headings.document_capture_html') %>
<% end %>
</h1>

<%= render 'idv/doc_auth/document_capture_notices', flow_session: flow_session %>

<%= simple_form_for(
:doc_auth,
url: url_for,
method: 'PUT',
html: { autocomplete: 'off', role: 'form', class: 'mt2' }
) do |f| %>
<%# ---- Front Image ----- %>

<hr class="mt3 mb3"/>
<div class="front-image">
<h2>
<%= t('doc_auth.headings.upload_front_html') %>
</h2>

<%= accordion('totp-info', t('doc_auth.tips.title_html'),
wrapper_css: 'my2 col-12 fs-16p') do %>
<%= render 'idv/doc_auth/tips_and_sample' %>
<div class='center'>
<%= image_tag(asset_url('state-id-sample-front.jpg'), height: 338, width: 450) %>
<%# ---- Back Image ----- %>

<hr class="mt3 mb3"/>
<div class="back-image">
<h2>
<%= t('doc_auth.headings.upload_back_html') %>
</h2>

<%= accordion('totp-info', t('doc_auth.tips.title_html'),
wrapper_css: 'my2 col-12 fs-16p') do %>
<%= render 'idv/doc_auth/tips_and_sample' %>
<div class='center'>
<%= image_tag(asset_url('state-id-sample-back.jpg'), height: 338, width: 450) %>
</div>
<% end %>

<%= f.input :back_image_data_url, as: :hidden %>
<%= f.input :back_image, label: false, as: :file, required: true, wrapper_class: 'mt3 sm-col-8' %>
<div class='my2' id='back_target'></div>
</div>
<% end %>

<%= f.input :front_image_data_url, as: :hidden %>
<%= f.input :front_image, label: false, as: :file, required: true, wrapper_class: 'mt3 sm-col-8' %>
<div class='my2' id='front_target'></div>
</div>
<%# ---- Selfie ----- %>
<% if liveness_checking_enabled? %>
<hr class="mt3 mb3"/>
<div class="selfie">
<h2>
<%= t('doc_auth.headings.selfie') %>
</h2>

<%# ---- Back Image ----- %>
<%= f.input :selfie_image_data_url, as: :hidden %>
<%= f.input :selfie_image, label: false, as: :file, required: true, wrapper_class: 'mt3 sm-col-8' %>
<div class='my2' id='selfie_target'></div>
</div>
<% end %>

<hr class="mt3 mb3"/>
<div class="back-image">
<h2>
<%= t('doc_auth.headings.upload_back_html') %>
</h2>
<%# ---- Submit ----- %>

<%= accordion('totp-info', t('doc_auth.tips.title_html'),
wrapper_css: 'my2 col-12 fs-16p') do %>
<%= render 'idv/doc_auth/tips_and_sample' %>
<div class='center'>
<%= image_tag(asset_url('state-id-sample-back.jpg'), height: 338, width: 450) %>
<div class='mt3'>
<%= render 'idv/doc_auth/submit_with_spinner' %>
</div>
<% end %>

<%= f.input :back_image_data_url, as: :hidden %>
<%= f.input :back_image, label: false, as: :file, required: true, wrapper_class: 'mt3 sm-col-8' %>
<div class='my2' id='back_target'></div>
</div>

<%# ---- Selfie ----- %>
<% if liveness_checking_enabled? %>
<hr class="mt3 mb3"/>
<div class="selfie">
<h2>
<%= t('doc_auth.headings.selfie') %>
</h2>

<%= f.input :selfie_image_data_url, as: :hidden %>
<%= f.input :selfie_image, label: false, as: :file, required: true, wrapper_class: 'mt3 sm-col-8' %>
<div class='my2' id='selfie_target'>
</div>
<% end %>

<%# ---- Submit ----- %>
<p class='mt3 mb0'><%= t('doc_auth.info.upload_image') %></p>

<div class='mt3'>
<%= render 'idv/doc_auth/submit_with_spinner' %>
<%= javascript_pack_tag 'image-preview' %>
</div>
<%= render 'idv/doc_auth/start_over_or_cancel' %>
<%= javascript_pack_tag 'document-capture' %>
<% end %>

<p class='mt3 mb0'><%= t('doc_auth.info.upload_image') %></p>

<%= render 'idv/doc_auth/start_over_or_cancel' %>
<%= javascript_pack_tag 'image-preview' %>
</div>
1 change: 1 addition & 0 deletions spec/features/idv/doc_auth/document_capture_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
and_return(document_capture_step_enabled)
allow(Figaro.env).to receive(:liveness_checking_enabled).
and_return(liveness_enabled)
allow(Figaro.env).to receive(:acuant_sdk_document_capture_enabled).and_return('true')
sign_in_and_2fa_user(user)
complete_doc_auth_steps_before_document_capture_step
end
Expand Down