Skip to content

Commit

Permalink
Add login button, expect callback URL from UPVS to be always /login f…
Browse files Browse the repository at this point in the history
…or safety reasons
  • Loading branch information
cizmarty committed Apr 26, 2024
1 parent fa820b8 commit 6fb5e03
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 56 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
4 changes: 4 additions & 0 deletions app/views/eid/onboarding/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<%= image_submit_tag 'google/btn_google_signin_dark_normal.svg', class: 'govuk-link', title: 'Prihlásiť sa cez Google', alt: 'Prihlásiť sa cez Google', style: 'max-width: 300px' %>
<% end %>

<%= form_tag(auth_path(:eid), method: :post, class: 'govuk-body govuk-!-margin-bottom-8') do %>
<%= image_submit_tag 'eid-sk.svg', class: 'govuk-link', title: 'Prihlásiť sa cez eID', alt: 'Prihlásiť sa cez eID', style: 'max-width: 300px' %>
<% end %>

<%= form_tag(auth_path(:magiclink), method: :post, id: 'login-email') do %>
<fieldset class="govuk-fieldset">
<div class="govuk-form-group">
Expand Down
4 changes: 4 additions & 0 deletions app/views/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<%= image_submit_tag 'google/btn_google_signin_dark_normal.svg', class: 'govuk-link', title: 'Prihlásiť sa cez Google', alt: 'Prihlásiť sa cez Google', style: 'max-width: 300px' %>
<% end %>

<%= form_tag(auth_path(:eid), method: :post, class: 'govuk-body govuk-!-margin-bottom-8') do %>
<%= image_submit_tag 'eid-sk.svg', class: 'govuk-link', title: 'Prihlásiť sa cez eID', alt: 'Prihlásiť sa cez eID', style: 'max-width: 300px' %>
<% end %>

<%= form_tag(auth_path(:magiclink), method: :post, id: 'login-email') do %>
<fieldset class="govuk-fieldset">
<div class="govuk-form-group">
Expand Down
1 change: 1 addition & 0 deletions config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
}
provider :eid, {
config: Rails.application.config_for(:auth).fetch(:eid),
callback_path: '/login',
}
end

1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
get '/auth/failure', to: 'sessions#failure'
get '/auth/:provider/callback', to: 'sessions#create', as: :auth_callback
post '/auth/:provider', to: lambda { |_| [404, {}, ["Not Found"]] }, as: :auth
get '/login', to: 'sessions#create', as: :login

resources :faqs, path: 'casto-kladene-otazky'
resources :pages, path: '', only: 'show'
Expand Down
55 changes: 2 additions & 53 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ ALTER SEQUENCE public.apps_id_seq OWNED BY public.apps.id;
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);


Expand Down Expand Up @@ -1325,41 +1325,6 @@ CREATE SEQUENCE upvs.form_template_related_documents_id_seq
ALTER SEQUENCE upvs.form_template_related_documents_id_seq OWNED BY upvs.form_template_related_documents.id;


--
-- Name: form_template_related_documents_temp; Type: TABLE; Schema: upvs; Owner: -
--

CREATE TABLE upvs.form_template_related_documents_temp (
id bigint NOT NULL,
posp_id character varying NOT NULL,
posp_version character varying NOT NULL,
message_type character varying NOT NULL,
xsd_schema text,
xslt_transformation text,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);


--
-- Name: form_template_related_documents_temp_id_seq; Type: SEQUENCE; Schema: upvs; Owner: -
--

CREATE SEQUENCE upvs.form_template_related_documents_temp_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


--
-- Name: form_template_related_documents_temp_id_seq; Type: SEQUENCE OWNED BY; Schema: upvs; Owner: -
--

ALTER SEQUENCE upvs.form_template_related_documents_temp_id_seq OWNED BY upvs.form_template_related_documents_temp.id;


--
-- Name: submissions; Type: TABLE; Schema: upvs; Owner: -
--
Expand Down Expand Up @@ -1616,13 +1581,6 @@ ALTER TABLE ONLY upvs.egov_application_allow_rules ALTER COLUMN id SET DEFAULT n
ALTER TABLE ONLY upvs.form_template_related_documents ALTER COLUMN id SET DEFAULT nextval('upvs.form_template_related_documents_id_seq'::regclass);


--
-- Name: form_template_related_documents_temp id; Type: DEFAULT; Schema: upvs; Owner: -
--

ALTER TABLE ONLY upvs.form_template_related_documents_temp ALTER COLUMN id SET DEFAULT nextval('upvs.form_template_related_documents_temp_id_seq'::regclass);


--
-- Name: submissions id; Type: DEFAULT; Schema: upvs; Owner: -
--
Expand Down Expand Up @@ -1902,14 +1860,6 @@ ALTER TABLE ONLY upvs.form_template_related_documents
ADD CONSTRAINT form_template_related_documents_pkey PRIMARY KEY (id);


--
-- Name: form_template_related_documents_temp form_template_related_documents_temp_pkey; Type: CONSTRAINT; Schema: upvs; Owner: -
--

ALTER TABLE ONLY upvs.form_template_related_documents_temp
ADD CONSTRAINT form_template_related_documents_temp_pkey PRIMARY KEY (id);


--
-- Name: submissions submissions_pkey; Type: CONSTRAINT; Schema: upvs; Owner: -
--
Expand Down Expand Up @@ -2481,7 +2431,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220914073624'),
('20220914073645'),
('20220914073653'),
('20220921082415');
('20220921082415'),
('20221022121113'),
('20221022143119'),
Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/eid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def callback_phase
end

def on_callback_path?
on_path?('/login')
on_path?('/auth/eid/callback') || on_path?('/login')
end

uid do
Expand Down

0 comments on commit 6fb5e03

Please sign in to comment.