Skip to content

Commit

Permalink
Merge branch 'master' into feature/658-preview-video-links-in-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
celuchmarek authored Nov 17, 2024
2 parents 1370899 + 7575597 commit 48c31c6
Show file tree
Hide file tree
Showing 65 changed files with 940 additions and 1,333 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ GEM
snaky_hash (~> 2.0)
version_gem (~> 1.1)
oj (3.14.2)
omniauth (2.1.1)
omniauth (2.1.2)
hashie (>= 3.4.6)
rack (>= 2.2.3)
rack-protection
Expand Down Expand Up @@ -295,7 +295,7 @@ GEM
que (>= 1)
sinatra
racc (1.7.1)
rack (2.2.8)
rack (2.2.9)
rack-protection (3.0.5)
rack
rack-proxy (0.7.6)
Expand Down
2 changes: 1 addition & 1 deletion app/assets/images/eid-sk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 18 additions & 11 deletions app/controllers/apps/ep_vote_app/application_forms_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Apps::EpVoteApp::ApplicationFormsController < ApplicationController
helper FormatDaysHelper
before_action :set_metadata, :check_inactive_ep_application, :disable_current_topic
before_action :disable_feedback, only: [:show, :delivery, :create]
before_action :disable_feedback, only: [:show, :delivery, :create, :send_email, :authorized_person_send]

def show
render_step('start')
Expand All @@ -12,13 +12,18 @@ def delivery
render_step('delivery')
end

def permanent_resident
def create
render_self
end

def authorized_person_send
return render_self if request.post?
render_step('permanent_resident')
redirect_to delivery_apps_ep_vote_app_application_forms_path
end

def create
render_self
def send_email
return render_self if request.post?
redirect_to delivery_apps_ep_vote_app_application_forms_path
end

private def render_self
Expand All @@ -34,9 +39,8 @@ def create
private def form_params
params.require(:apps_ep_vote_app_application_form).permit(
:step,
:place_first_round,
:place_second_round,
:sk_citizen,
:place,
:citizenship,
:delivery,
:full_name, :pin, :nationality, :maiden_name,
:authorized_person_full_name, :authorized_person_pin,
Expand All @@ -45,14 +49,17 @@ def create
:delivery_street, :delivery_pobox, :delivery_municipality, :delivery_country,
:municipality_email,
:municipality_email_verified,
:permanent_resident,
:back
:sk_citizen_residency,
:back,
:eu_citizen_residency,
:eu_citizen_sk_resident,
:eu_citizen_non_sk_resident
)
end

private def set_metadata
@metadata.og.title = 'Žiadosť o hlasovací preukaz'
@metadata.og.image = 'https://volby.digital/images/share-2024.png'
@metadata.og.image = 'https://volby.digital/images/share-ep-2024.png'
@metadata.og.description = 'Aj keď budete počas volieb mimo trvalého pobytu, voliť sa dá. Stačí požiadať.'
end

Expand Down

This file was deleted.

28 changes: 26 additions & 2 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ def create
end

if new_eid_identity?
unless fully_represents_subject?
render :insufficient_representation, locals: { eid_token: eid_token }
return
end

render :new_eid_identity, locals: { eid_token: eid_token }
return
end
Expand All @@ -25,7 +30,18 @@ def create
notice = user.previously_new_record? ? 'first_time_login' : 'Prihlásenie úspešné. Vitajte!'

if eid_identity_approval?
user.update!(eid_sub: eid_sub_from_auth)
assertion = Upvs::Assertion.assertion(eid_token)

if assertion
user.update!(
eid_sub: eid_sub_from_auth,
subject_name: assertion.subject_name,
subject_cin: assertion.subject_cin,
subject_edesk_number: assertion.subject_edesk_number,
)
else
user.update!(eid_sub: eid_sub_from_auth)
end
end

unless should_keep_eid_token_in_session?(user.eid_sub)
Expand Down Expand Up @@ -57,7 +73,10 @@ def logout

def destroy
if should_perform_eid_logout?
redirect_to eid_token.generate_logout_url(expires_in: 5.minutes)
eid_logout_url = eid_token.generate_logout_url(expires_in: 5.minutes)
reset_session

redirect_to eid_logout_url
else
logout
end
Expand Down Expand Up @@ -95,4 +114,9 @@ def after_login_redirect_path
return session[:after_login_callback] if session[:after_login_callback]&.start_with?("/") # Only allow local redirects
root_path
end

def fully_represents_subject?
assertion = Upvs::Assertion.assertion(eid_token)
assertion&.fully_represents_subject?
end
end
Loading

0 comments on commit 48c31c6

Please sign in to comment.