mirror of
https://github.com/System-End/identity-vault.git
synced 2026-04-19 22:05:07 +00:00
* Extract verification flow logic into VerificationFlow concern Move document submission handling and helper methods from VerificationsController into a reusable concern: - setup_document_step, handle_document_submission - process_legal_name, process_aadhaar_number - create_verification, document_params - verification_should_redirect? helper Extract document form into shared partial for reuse across regular and portal verification flows. * Extract address building into AddressManagement concern Move build_address helper into a shared concern for reuse between AddressesController and Portal::AddressesController. * Add PortalFlow concern and base controller for external app flows PortalFlow provides secure redirect handling for portal flows: - Validates return URLs against registered Program redirect URIs - Stores validated URLs in session to prevent tampering - Allows localhost in non-production environments - Provides redirect helpers with portal_status query param Portal::BaseController uses logged_out layout with portal_wrapper content block for minimal UI. * Add portal controllers and routes for external app integration Portal::VerificationsController handles document verification flow triggered by external OAuth apps, with status-based redirects. Portal::AddressesController handles address collection with manage view for users who already have addresses. Routes: - GET/POST/DELETE /portal/verify - GET/POST /portal/address - GET /portal/address/done Also adds make_primary member route to addresses resource. * Add HTMX support to AddressesController for dynamic updates Refactor AddressesController: - Extract create/primary logic into helper methods - Add HTMX-aware response methods for partial updates - Support portal context detection for shared address list Add partials: - _address_list.html.erb: Shared address list with HTMX actions - _edit_form.html.erb: Inline edit form for HTMX requests - Update _form.html.erb with HTMX form attributes when target provided Address list supports both regular and portal contexts with appropriate HTMX targets and translations. * Add portal views and translations Portal views: - verifications/document.html.erb: Document upload for portal flow - verifications/pending.html.erb: Pending verification status - addresses/portal.html.erb: Initial address collection form - addresses/manage.html.erb: Address list for existing addresses Update logged_out layout to support portal_wrapper content block with minimal brand header for portal flows. Add HTMX CSRF header. Add translations for portal verification and address flows. * Add Program.official scope and update address styles Add scope to filter HQ-official programs. Update address styles for portal and HTMX address management: - Improved address card layout with flex - Add address card and button styles - Pending verification card styles - Portal done button styling * fix address nit?
65 lines
1.2 KiB
Ruby
65 lines
1.2 KiB
Ruby
class VerificationsController < ApplicationController
|
|
include Wicked::Wizard
|
|
include VerificationFlow
|
|
|
|
before_action :set_identity
|
|
|
|
steps :document
|
|
|
|
def new
|
|
status = current_identity.verification_status
|
|
if verification_should_redirect?(status)
|
|
redirect_to verification_status_path
|
|
return
|
|
end
|
|
|
|
redirect_to verification_step_path(:document)
|
|
end
|
|
|
|
def status
|
|
@identity = current_identity
|
|
@status = @identity.verification_status
|
|
@latest_verification = @identity.latest_verification
|
|
end
|
|
|
|
def show
|
|
@identity = current_identity
|
|
|
|
status = @identity.verification_status
|
|
if verification_should_redirect?(status)
|
|
redirect_to verification_status_path
|
|
return
|
|
end
|
|
|
|
case step
|
|
when :document
|
|
setup_document_step
|
|
end
|
|
|
|
render_wizard
|
|
end
|
|
|
|
def update
|
|
@identity = current_identity
|
|
|
|
case step
|
|
when :document
|
|
handle_document_submission
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def set_identity
|
|
@identity = current_identity
|
|
end
|
|
|
|
def on_verification_success
|
|
flash[:success] = "Your documents have been submitted for review! We'll email you when they're processed."
|
|
redirect_to root_path
|
|
end
|
|
|
|
def on_verification_failure
|
|
render_wizard
|
|
end
|
|
end
|