Skip to content
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

LG-1090 LG-1091 Add message for doc auth recovery success #2849

Merged
merged 5 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from 4 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
11 changes: 5 additions & 6 deletions app/services/flow/base_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ class BaseFlow
attr_accessor :flow_session
attr_reader :steps, :actions, :current_user, :params, :request

def initialize(steps, actions, session, current_user)
@current_user = current_user
def initialize(controller, steps, actions, session)
@controller = controller
@steps = steps.with_indifferent_access
@actions = actions.with_indifferent_access
@params = nil
@redirect = nil
@flow_session = session
end
Expand All @@ -24,12 +23,10 @@ def redirect_to(url)
@redirect = url
end

def handle(step, request, params)
def handle(step)
@flow_session[:error_message] = nil
handler = steps[step] || actions[step]
return failure("Unhandled step #{step}") unless handler
@params = params
@request = request
wrap_send(handler)
end

Expand All @@ -46,5 +43,7 @@ def form_response(obj, value)
obj.mark_step_complete if response.success?
response
end

delegate :flash, :session, :current_user, :params, :request, to: :@controller
end
end
2 changes: 1 addition & 1 deletion app/services/flow/base_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ def reset
@flow.flow_session = {}
end

delegate :session, :flow_session, :current_user, :params, :steps, :request, to: :@flow
delegate :flash, :session, :flow_session, :current_user, :params, :steps, :request, to: :@flow
end
end
4 changes: 2 additions & 2 deletions app/services/flow/flow_state_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def show

def update
step = params[:step]
result = flow.handle(step, request, params)
result = flow.handle(step)
analytics.track_event(analytics_submitted, result.to_h.merge(step: step)) if @analytics_id
flow_finish and return unless next_step
render_update(step, result)
Expand All @@ -34,7 +34,7 @@ def fsm_initialize
@name = klass.name.underscore.gsub('_controller', '')
klass::FSM_SETTINGS.each { |key, value| instance_variable_set("@#{key}", value) }
current_session[@name] ||= {}
@flow = @flow.new(current_session, current_user, @name)
@flow = @flow.new(self, current_session, @name)
end

def render_update(step, result)
Expand Down
4 changes: 2 additions & 2 deletions app/services/idv/flows/capture_doc_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class CaptureDocFlow < Flow::BaseFlow
reset: Idv::Actions::ResetAction,
}.freeze

def initialize(session, current_user, _name)
super(STEPS, ACTIONS, session, current_user)
def initialize(controller, session, _name)
super(controller, STEPS, ACTIONS, session)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/services/idv/flows/doc_auth_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class DocAuthFlow < Flow::BaseFlow

attr_reader :idv_session # this is needed to support (and satisfy) the current LOA3 flow

def initialize(session, current_user, name)
def initialize(controller, session, name)
@idv_session = self.class.session_idv(session)
super(STEPS, ACTIONS, session[name], current_user)
super(controller, STEPS, ACTIONS, session[name])
end

def self.session_idv(session)
Expand Down
4 changes: 2 additions & 2 deletions app/services/idv/flows/recovery_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class RecoveryFlow < Flow::BaseFlow

attr_reader :idv_session, :session # needed to support (and satisfy) the current LOA3 flow

def initialize(session, current_user, name)
def initialize(controller, session, name)
@session = session
@idv_session = self.class.session_idv(session)
super(STEPS, ACTIONS, session[name], current_user)
super(controller, STEPS, ACTIONS, session[name])
end

def self.session_idv(session)
Expand Down
9 changes: 7 additions & 2 deletions app/services/idv/steps/recover_doc_success_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ def call
decrypted_pii = JSON.parse(saved_pii)
return unless pii_matches_data_on_file?(pii_from_doc, decrypted_pii)

recovery_success
end

private

def recovery_success
mark_step_complete(:recover_fail)
flash[:success] = I18n.t('recover.reverify.success')
redirect_to account_url
session['need_two_factor_authentication'] = false
end

private

def saved_pii
session['decrypted_pii']
end
Expand Down
2 changes: 1 addition & 1 deletion config/locales/doc_auth/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ en:
use a scanner to capture images of your ID
upload_from_phone: Upload pictures directly from your phone camera
upload_image: We only use your ID to verify your identity, and we will not save
any images. We accept PDF, PNG, and JPG formats.
any images. We accept BMP, PNG, TIFF, and JPG formats.
welcome: We verify your identity to make sure you are you—not someone pretending
to be you. Verifying your identity also allows you to access services that
handle Personal Identifiable Information.
Expand Down
2 changes: 1 addition & 1 deletion config/locales/doc_auth/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ es:
o use un escáner para capturar imágenes de su identificación
upload_from_phone: Sube imágenes directamente desde la cámara de tu teléfono
upload_image: Solo utilizamos su ID para verificar su identidad y no guardaremos
ninguna imagen. Aceptamos formatos PDF, PNG, y JPG.
ninguna imagen. Aceptamos los formatos BMP, PNG, TIFF y JPG.
welcome: Verificamos su identidad para asegurarnos de que usted es usted, y
no alguien que pretende ser usted. La verificación de su identidad también
le permite acceder a servicios que manejan información de identificación personal.
Expand Down
4 changes: 2 additions & 2 deletions config/locales/doc_auth/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ fr:
upload_from_phone: Téléchargez des images directement depuis l'appareil photo
de votre téléphone
upload_image: Nous n'utilisons votre identifiant que pour vérifier votre identité,
et nous n'enregistrerons aucune image. Nous acceptons les formats PDF, PNG
et JPG.
et nous n'enregistrerons aucune image. Nous acceptons les formats BMP, PNG,
TIFF et JPG.
welcome: Nous vérifions votre identité pour nous assurer que vous êtes bien,
et non quelqu'un prétendant être vous. La vérification de votre identité vous
permet également d'accéder à des services traitant des informations personnelles
Expand Down
3 changes: 3 additions & 0 deletions config/locales/recover/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ en:
fail: Recover fail
instructions: We want to make sure you, and only you, have access to your account
reverify: Next, let's re-verify your identity
success: You have successfully recovered your account. To prevent having to
recover your account in the future, please add another security option from
the two-factor authentication options below.
3 changes: 3 additions & 0 deletions config/locales/recover/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ es:
instructions: Queremos asegurarnos de que usted, y solo usted, tenga acceso
a su cuenta
reverify: A continuación, volvamos a verificar su identidad
success: Has recuperado exitosamente tu cuenta. Para evitar tener que recuperar
su cuenta en el futuro, agregue otra opción de seguridad de las siguientes
opciones de autenticación de dos factores.
3 changes: 3 additions & 0 deletions config/locales/recover/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ fr:
instructions: Nous voulons nous assurer que vous et seulement vous avez accès
à votre compte
reverify: Ensuite, revérifions votre identité
success: Vous avez bien récupéré votre compte. Pour éviter de devoir récupérer
votre compte à l'avenir, veuillez ajouter une autre option de sécurité parmi
les options d'authentification à deux facteurs ci-dessous.
46 changes: 0 additions & 46 deletions spec/services/idv/flows/doc_auth_flow_spec.rb

This file was deleted.