mirror of
https://github.com/System-End/identity-vault.git
synced 2026-04-19 22:05:07 +00:00
* INITIAL SAML SUPPORT WOO YEA BABEY it works? * wawa * mwaow * b * WOAG * mph * bunch more stuff * new OAuth screen * add trust level to oauth apps * [community oauth] new scopes, validate only some community ones * bleh * my info first pass * sessions and 2fa * oauth authorizations/revoke * nuke sms * fix drift * remove hcid on ident#edit * attack our rack? * session fixation't * first pass at stepup auth * eye eighteen en * fix brand * think that does it for dev mode! * add promote to full user button * first crack at landing page * better sessions * better id edit * better verf * less css pass 1 * add phone no * better cssed? * securité * switch from slocks * HCA * touch last seen at * session fingerprinting * improved? * localize scopes * add proper oauth welcome * eepier tutorial * how long was that like that?! * common blankslate * better addresses? * [backend] fix reprovisioning and promotion * improve addresses * ICONS, BEAUTIFUL ICONS * primary sidebar * saml welcome? * new totp flow? * marginally better login sec * better print for backup codes! * MASSIVE LINT PASS * autocompletes * woops * new staging * actual login code txnl * no more legacy slack account linking * fake slack in staging * no account yet? * add samls for staging * fix slack_staging * lint * frickin' xmlsec * no validate keys ? * AUGH * ASGJHFGSDJFG * shoot me * aieeeee * SCHEIßE * no more attempt association on code * believe in prefers-color-scheme * fix verf icon * nuke vestigial aadhaar functionality thanks deployor! * fix xmlsec on gh ci * remove identity (#27) * move idcon flashes to locale * remove dead code impersonation logic h/t ian! * fix hx-confirm on delete address? * add missing dev app locale key * fix #28 * wait, i'm an idiot (#28) * THERE WE GO * add paper_trail to more stuff * red delete btn * more red delete btns * THE AUDIT LOGS UPDATE * yuge lint pass * Fix icons (#33) Some icons didn't have a fill nor a viewbox * weh * first pass at docs * memoize docs, fix 404 * [docs] add crappy erb support * support non-e+ flow * fix no devmode locale * DOCS DOCS DOCS * tldr dev doc * anti-clickjacking countdown (h/t @J-Meow) * weh * get rid of those, they do nothing for us * dependent destroy * find user via scim if ent * save nav channel ids * fix base onboarding scenario * only unique among the living * add SAML debug * simplify legacy_email * add UAT env * we ARE * add slack to uat * no entity id? * fix saml if logged out * fix scim assignment? * bring channels into config * darn it * try backoff on assign_to_workspace?? this feels problematic * do the scim docs lie? * that was dumb * Revert "do the scim docs lie?" This reverts commit 69310dbef9476f2103d7a8280966a7fdf732129b. * Revert "try backoff on assign_to_workspace?? this feels problematic" This reverts commit 7a5edd67aa3836df1f31d628566e9ea69589c269. * this some bull shit * internal tutorial by default * 18 point something * fixes: componentize login, no more viewcontext, parse sp-initiated saml better * one return to. * just send it * fix replay bug * fix URL in welcome docs page (#38) * simplify login/signup flow, s/faq/terms + privacy * no more H... we hardly knew you * first pass at reddening * red pt. 2 * she's red for an AMAZING reason * lint pass * fix tooled tips * another docs pass * initial pass at factorybotting docs * scope diffing for api docs! * wait we don't need a legend lol * add verf status to community apps * fricken lint * make current_user not nomethod * move are_we_enterprise_yet to a flipper flag * improve slack racing * allow not creating slack * factorybot in prod for api docs! * LOL, LMAO * properly set owner on oauthorizations * lint pass * bypass age on existing users * fix that... --------- Co-authored-by: Leo <leo@wilkin.xyz> Co-authored-by: Tom (Deployor) <129990841+deployor@users.noreply.github.com> Co-authored-by: DaInfLoop <github@dainfloop.is-a.dev>
123 lines
3.6 KiB
Ruby
123 lines
3.6 KiB
Ruby
class VerificationsController < ApplicationController
|
|
include Wicked::Wizard
|
|
before_action :set_identity
|
|
|
|
steps :document
|
|
|
|
def new
|
|
# Redirect to status page if they shouldn't be submitting
|
|
status = current_identity.verification_status
|
|
if status == "pending" || status == "verified" || status == "ineligible"
|
|
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
|
|
|
|
# Redirect to status page if they shouldn't be filling out the form
|
|
status = @identity.verification_status
|
|
if status == "pending" || status == "verified" || status == "ineligible"
|
|
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 setup_document_step
|
|
@is_resubmission = @identity.needs_resubmission?
|
|
@rejected_verifications = @identity.rejected_verifications_needing_resubmission if @is_resubmission
|
|
@document = Identity::Document.new(identity: @identity)
|
|
end
|
|
|
|
def handle_document_submission
|
|
@document = Identity::Document.new(document_params)
|
|
@document.identity = @identity
|
|
|
|
# Update legal name if different from preferred name
|
|
legal_first = params[:legal_first_name]
|
|
legal_last = params[:legal_last_name]
|
|
|
|
if legal_first.present? && legal_last.present?
|
|
# Only save legal name if it's different from preferred name
|
|
if legal_first != @identity.first_name || legal_last != @identity.last_name
|
|
@identity.legal_first_name = legal_first
|
|
@identity.legal_last_name = legal_last
|
|
else
|
|
# If same as preferred name, clear legal name fields
|
|
@identity.legal_first_name = nil
|
|
@identity.legal_last_name = nil
|
|
end
|
|
|
|
unless @identity.save
|
|
@is_resubmission = @identity.needs_resubmission?
|
|
@rejected_verifications = @identity.rejected_verifications_needing_resubmission if @is_resubmission
|
|
@document.errors.add(:base, "Legal name: #{@identity.errors.full_messages.join(', ')}")
|
|
render_wizard
|
|
return
|
|
end
|
|
end
|
|
|
|
# Update Aadhaar number if provided (for India)
|
|
if params[:aadhaar_number].present?
|
|
@identity.aadhaar_number = params[:aadhaar_number]
|
|
unless @identity.save
|
|
@is_resubmission = @identity.needs_resubmission?
|
|
@rejected_verifications = @identity.rejected_verifications_needing_resubmission if @is_resubmission
|
|
@document.errors.add(:base, "Aadhaar number: #{@identity.errors[:aadhaar_number].join(', ')}")
|
|
render_wizard
|
|
return
|
|
end
|
|
end
|
|
|
|
if @document.save
|
|
# Create the verification
|
|
verification = Verification::DocumentVerification.create!(
|
|
identity: @identity,
|
|
identity_document: @document,
|
|
status: :pending
|
|
)
|
|
|
|
flash[:success] = "Your documents have been submitted for review! We'll email you when they're processed."
|
|
redirect_to root_path
|
|
else
|
|
@is_resubmission = @identity.needs_resubmission?
|
|
@rejected_verifications = @identity.rejected_verifications_needing_resubmission if @is_resubmission
|
|
render_wizard
|
|
end
|
|
end
|
|
|
|
def document_params
|
|
params.require(:identity_document).permit(:document_type, files: [])
|
|
end
|
|
end
|