mirror of
https://github.com/System-End/identity-vault.git
synced 2026-04-19 23:22:50 +00:00
* first shot * it works! * fix addr portal start action * fix add address button * pass in country * that should do it! * wew! * lint
61 lines
1.2 KiB
Ruby
61 lines
1.2 KiB
Ruby
class Portal::VerificationsController < Portal::BaseController
|
|
include VerificationFlow
|
|
|
|
before_action :validate_portal_return_url, only: [ :start ]
|
|
before_action :store_return_url, only: [ :start ]
|
|
|
|
def start
|
|
@identity = current_identity
|
|
status = @identity.verification_status
|
|
|
|
case status
|
|
when "verified"
|
|
redirect_to_portal_return(status: :verified)
|
|
when "pending"
|
|
redirect_to_portal_return(status: :pending)
|
|
end
|
|
end
|
|
|
|
def portal
|
|
@identity = current_identity
|
|
status = @identity.verification_status
|
|
|
|
case status
|
|
when "verified"
|
|
redirect_to_portal_return(status: :verified)
|
|
return
|
|
when "pending"
|
|
redirect_to_portal_return(status: :pending)
|
|
return
|
|
end
|
|
|
|
setup_document_step
|
|
render :document
|
|
end
|
|
|
|
def cancel
|
|
cancel_portal_flow
|
|
end
|
|
|
|
def create
|
|
@identity = current_identity
|
|
|
|
status = @identity.verification_status
|
|
if status == "pending" || status == "verified"
|
|
redirect_to_portal_return(status: status.to_sym)
|
|
return
|
|
end
|
|
|
|
handle_document_submission
|
|
end
|
|
|
|
private
|
|
|
|
def on_verification_success
|
|
redirect_to_portal_return(status: :submitted)
|
|
end
|
|
|
|
def on_verification_failure
|
|
render :document
|
|
end
|
|
end
|