From 966bed712588cd8d42f136986230524221846867 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 30 Apr 2024 15:40:52 +0200 Subject: [PATCH] Do not offer EID login unless env set --- app/views/eid/onboarding/new.html.erb | 6 ++++-- app/views/sessions/new.html.erb | 6 ++++-- config/routes.rb | 7 +++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/views/eid/onboarding/new.html.erb b/app/views/eid/onboarding/new.html.erb index b86971eb..9e3e7ff8 100644 --- a/app/views/eid/onboarding/new.html.erb +++ b/app/views/eid/onboarding/new.html.erb @@ -13,8 +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' %> + <% if ENV['AUTH_EID_BASE_URL'].present? %> + <%= 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 %> <% end %> <%= form_tag(auth_path(:magiclink), method: :post, id: 'login-email') do %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 71cdd1d8..a4fc810f 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -13,8 +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 slovensko.sk', alt: 'Prihlásiť sa cez slovensko.sk', style: 'max-width: 300px' %> + <% if ENV['AUTH_EID_BASE_URL'].present? %> + <%= 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 slovensko.sk', alt: 'Prihlásiť sa cez slovensko.sk', style: 'max-width: 300px' %> + <% end %> <% end %> <%= form_tag(auth_path(:magiclink), method: :post, id: 'login-email') do %> diff --git a/config/routes.rb b/config/routes.rb index 3bebd8f9..cf99a807 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -171,8 +171,11 @@ 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 - get '/logout', to: 'sessions#destroy', as: :logout + + if ENV['AUTH_EID_BASE_URL'].present? + get '/login', to: 'sessions#create', as: :login + get '/logout', to: 'sessions#destroy', as: :logout + end resources :faqs, path: 'casto-kladene-otazky' resources :pages, path: '', only: 'show'