Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EID and SVM login #475

Open
wants to merge 209 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
209 commits
Select commit Hold shift + click to select a range
d18be0b
Implement stub for EID authentication strategy
alhafoudh Apr 7, 2022
084202f
Add TODO notes
mirrec Apr 7, 2022
c94a6ab
Extract eid provider options to ENV and implement JWT token verification
alhafoudh Apr 7, 2022
6644f23
Merge
mirrec Apr 7, 2022
0f9158f
Fix hash key reference
alhafoudh Apr 7, 2022
1480b32
Merge branch 'eid-login' of github.com:slovensko-digital/navody.digit…
mirrec Apr 7, 2022
9123a02
Add eid_sub field to User model
mirrec Apr 7, 2022
ade5eec
Add endpoint for finishing eid onboarding
mirrec Apr 7, 2022
b4e0a58
add eid login button variants
MarekVigas Apr 7, 2022
841fb59
change login view
MarekVigas Apr 7, 2022
8c2404b
Add url to sample
mirrec Apr 7, 2022
b4361d3
Merge branch 'eid-login' of github.com:slovensko-digital/navody.digit…
mirrec Apr 7, 2022
28da00c
update wording
MarekVigas Apr 7, 2022
31d866c
keep sample env empty
MarekVigas Apr 7, 2022
9cdffdb
Move eid onboarding to namespace
alhafoudh Apr 8, 2022
e6ba6ca
prepare controller for business register
martyciz Jun 24, 2022
b6ff12d
Finish eid login with magic link verification
alhafoudh Jun 24, 2022
b7d4732
service for retrieving business acts
martyciz Jun 24, 2022
d4f6948
Implement EID logout
alhafoudh Jun 24, 2022
0a0148d
controller API points for getting business acts
martyciz Jun 24, 2022
9019ecb
Handle sk.sk callback redirect
alhafoudh Jun 24, 2022
d7bfb1a
Merge branch 'master' into eid-login
alhafoudh Jun 24, 2022
b758ab7
Fix double render
alhafoudh Jun 24, 2022
1ad56ae
Refactor condition to method
alhafoudh Jun 24, 2022
f1a63dc
Refactor condition to method
alhafoudh Jun 24, 2022
19226e7
Add SkTalk, ApplicationForDocumentCopy builders
luciajanikova Jun 24, 2022
0ef2648
Merge branch 'feature/orsr-submission' of https://github.com/slovensk…
luciajanikova Jun 24, 2022
fbec553
Remove skipping JWT verification in development env
alhafoudh Jun 24, 2022
0b358f4
Refactor EID token parsing to EidToken model
alhafoudh Jun 24, 2022
20d7fbe
form builder and generating XML, prepared send XML form
martyciz Jun 24, 2022
57009f1
Pass EID token using forms up to the point user is authenticated and …
alhafoudh Jun 25, 2022
377459b
Keep EID token in session but remove it when it does not match with E…
alhafoudh Jun 25, 2022
f38122d
form for submit and form for generating XML - WIP
martyciz Jun 25, 2022
d0c0a98
Extract logout URL generation to EidToken model
alhafoudh Jun 25, 2022
660bf68
Prepare Upvs Submissions API, views
luciajanikova Jun 25, 2022
f323b32
Merge branch 'feature/orsr-submission' of https://github.com/slovensk…
luciajanikova Jun 25, 2022
68e8954
Extract EID token related controller methods to EidAuth concern
alhafoudh Jun 25, 2022
7f57d92
generate XML with form
martyciz Jun 25, 2022
d494f50
Update form path
luciajanikova Jun 25, 2022
848e4f2
Merge branch 'feature/orsr-submission' of https://github.com/slovensk…
luciajanikova Jun 25, 2022
1fd0d8e
Fix putting EID token into session
alhafoudh Jun 25, 2022
7e67c48
Indicate presence of EID token in session
alhafoudh Jun 25, 2022
94ec91d
Fix null reference
alhafoudh Jun 25, 2022
d9215a4
Fix putting EID token to session
alhafoudh Jun 25, 2022
1a5f97e
fetch company and acts using JS
martyciz Jun 25, 2022
10a5bd3
Update navody-digital-frontend npm package
alhafoudh Jun 25, 2022
1cac8b3
Merge branch 'update-govuk' into eid-login
alhafoudh Jun 25, 2022
3b623a8
Add form visualisation
luciajanikova Jun 25, 2022
d2467b9
Merge branch 'feature/orsr-submission' of https://github.com/slovensk…
luciajanikova Jun 25, 2022
9873090
Tweak new EID identity view style
alhafoudh Jun 25, 2022
4c7f59e
Update navody-digital-frontend npm package (pt. 2)
alhafoudh Jun 25, 2022
4d604d4
Update node version to 16.15.1 again
alhafoudh Jun 25, 2022
dc8eaf7
Merge branch 'eid-login' of https://github.com/slovensko-digital/navo…
luciajanikova Jun 25, 2022
ba34520
Merge branch 'eid-login' of https://github.com/slovensko-digital/navo…
luciajanikova Jun 25, 2022
449af3f
Updates
luciajanikova Jun 25, 2022
4991f2a
refactor code to use form object
martyciz Jun 25, 2022
a845474
Html, css, js files for mobile formular
danielstaleiny Jun 25, 2022
bc7851c
Merge branch 'feature/orsr-submission' of https://github.com/slovensk…
luciajanikova Jun 25, 2022
cf1182d
Merge pull request #489 from danielstaleiny/feature/orsr-submission
cizmarty Jun 25, 2022
928554b
merge HTML,CSS, working form
martyciz Jun 25, 2022
6f8bc6e
working XML query
martyciz Jun 25, 2022
d00a6c8
fix companies select
martyciz Jun 25, 2022
02d4663
send XML within hidden form
martyciz Jun 25, 2022
79edf6e
Create Upvs::FormTemplateRelatedDocuments, Update Upvs::EgovApplicati…
luciajanikova Jul 15, 2022
f99658e
Add sk-api login&logout, form visualisation. submission to sk-api, fi…
luciajanikova Jul 22, 2022
1db705d
Frontend fixes
luciajanikova Jul 25, 2022
6889c68
Merge branch 'master' into eid-login
alhafoudh Jul 25, 2022
30901d6
Tweak actor retrieval from OBO token
alhafoudh Jul 25, 2022
71389e5
Fix node version for navody-frontend package
alhafoudh Jul 25, 2022
01ea659
Add support for error cases (OBO token expires before submit/submit f…
luciajanikova Jul 27, 2022
686881f
Small frontend fixes
luciajanikova Jul 27, 2022
1f63884
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova Jul 27, 2022
835201e
Revert node version upgrade
luciajanikova Jul 27, 2022
2f6a817
Merge branch 'eid-login' of https://github.com/slovensko-digital/navo…
luciajanikova Jul 27, 2022
5234fc9
Merge branch 'eid-login' of https://github.com/slovensko-digital/navo…
luciajanikova Jul 27, 2022
6eef1c0
Merge branch 'master' of https://gitlab.bonet.sk/slovensko.digital/na…
luciajanikova Jul 27, 2022
c5653d8
Update package.json
luciajanikova Jul 27, 2022
ab8115c
Update yarn.lock, Dockerfile
luciajanikova Jul 27, 2022
0cd486a
Try to update caniuse-lite
luciajanikova Jul 28, 2022
7f00cae
Try to fix babel config
luciajanikova Jul 28, 2022
4e57e8e
Try to fix babel config II
luciajanikova Jul 28, 2022
e619675
Revert naovdy-frontend import changes
luciajanikova Jul 28, 2022
ca3b637
Update ApplicationForDocumentCopy default_recipient_uri for staging
luciajanikova Jul 28, 2022
2521795
Add data utils routes
luciajanikova Jul 28, 2022
cdb0da5
Fixes for successful UPVS submission
luciajanikova Jul 29, 2022
d77e60a
Fix sender_uri
luciajanikova Aug 3, 2022
ec3129e
Add AddUpvsFormToWhiteListJob
luciajanikova Aug 3, 2022
9eec2da
Small text fixes + add or_sr listiny callback
luciajanikova Aug 3, 2022
6d71486
Divide filling form into 3 steps
luciajanikova Aug 9, 2022
c615c3e
Update routes, view templates
luciajanikova Aug 10, 2022
ace5ca6
Draft spinner
luciajanikova Aug 11, 2022
50c416b
Spinner finalization
luciajanikova Aug 18, 2022
a3a4790
Small frontend fixes
luciajanikova Aug 18, 2022
565f19f
Refactor FE
luciajanikova Sep 5, 2022
cc14282
Merge branch 'master' into eid-login
alhafoudh Sep 16, 2022
22f1fd9
Small updates
luciajanikova Oct 18, 2022
bc50f8e
Add two-thirds layout
luciajanikova Oct 18, 2022
6604926
Finalize app
luciajanikova Oct 20, 2022
f676284
Unify css with ORSR identifiers app
luciajanikova Oct 20, 2022
9147758
Unify line endlings
luciajanikova Oct 20, 2022
08b9fce
Fix back button
luciajanikova Oct 20, 2022
ed4f16f
Fix iframe height
luciajanikova Oct 20, 2022
3549d40
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova Oct 20, 2022
240af08
Small fixes
luciajanikova Oct 20, 2022
72ad5b9
Fix structure.sql
luciajanikova Oct 20, 2022
76ceadd
Handle case when actor key value can be null
alhafoudh Oct 20, 2022
db5c8bb
Handle case when actor key value can be null
alhafoudh Oct 20, 2022
ed48def
Merge branch 'master' into eid-login
alhafoudh Oct 21, 2022
8c4c322
Try to fix iframe, acts view
luciajanikova Oct 21, 2022
35e56b4
Handle enter press
luciajanikova Oct 21, 2022
d172475
Update copy
luciajanikova Oct 22, 2022
6d0047b
Fix form builder indent
luciajanikova Oct 22, 2022
35a31d5
Update raising errors
luciajanikova Oct 22, 2022
87368eb
Add un/check all acts option
luciajanikova Oct 22, 2022
aa9f6e6
Disable eID login as a login method to app
luciajanikova Oct 22, 2022
432303f
Update copy
luciajanikova Oct 22, 2022
983e2a9
Add eID/SVM login info
luciajanikova Oct 22, 2022
ec812fa
Update links to documents
luciajanikova Oct 22, 2022
7587cd3
Update links to documents
luciajanikova Oct 22, 2022
367e020
Update routes
luciajanikova Oct 22, 2022
9faa6c5
Remova comments from routes
luciajanikova Oct 22, 2022
b23e400
Bump gems and JS dependencies (#528)
celuchmarek Oct 22, 2022
90c6d5c
ND-150 Homepage redizajn s kategóriami (#491)
celuchmarek Oct 22, 2022
8ac31aa
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova Oct 22, 2022
0343c3f
Fix structure.sql
luciajanikova Oct 22, 2022
084a9a2
Fix structure sql II
luciajanikova Oct 22, 2022
f1dd421
Merge pull request #495 from slovensko-digital/feature/orsr-submission
luciajanikova Oct 22, 2022
1a4adab
fix homepage categories to tripplets in rows (#538)
celuchmarek Oct 22, 2022
e449412
350 duplikovanie elementov pri pouziti history goback (#533)
marianJ97 Oct 24, 2022
2b448ae
Svg logo (#535)
mar-vic Oct 24, 2022
d81e058
Setup readme (#529)
johnnypea Oct 24, 2022
19c48e8
Add deadline component, refs #147 (#277)
jsuchal Oct 25, 2022
420b0b6
rm journeys prefix from pages og image metadata tag (#541)
celuchmarek Nov 22, 2022
9f71e5b
Make code list queries case insensitive, Update checking stakeholder …
luciajanikova Dec 22, 2022
4773a21
Refactor
luciajanikova Dec 22, 2022
9e6f1ed
Merge pull request #554 from slovensko-digital/ND-159/small_fixes
luciajanikova Dec 22, 2022
1cabd96
add docker registry to gitlab config (#557)
celuchmarek Jan 12, 2023
fbc5431
Do not pre-define message of the deadline component (#543)
crutch Jan 18, 2023
b77a0a3
Bump rack from 2.2.4 to 2.2.6.2 (#558)
dependabot[bot] Jan 19, 2023
d09c07c
Bump globalid from 1.0.0 to 1.0.1 (#559)
dependabot[bot] Mar 23, 2023
5f82f3c
Bump ruby & gems (#567)
jsuchal Mar 24, 2023
2e7d789
set resource requests (#561)
celuchmarek Mar 24, 2023
1e43508
Migrate que table to new version (#572)
jsuchal Mar 25, 2023
dc1ecbb
Add no acts option
luciajanikova Mar 25, 2023
d5f75e6
Bump navody-digital-frontend npm package (#568)
alhafoudh Mar 25, 2023
4ee5198
Bonus actions (#569)
jsuchal Mar 25, 2023
ef50464
Do not show timeline for journeys without steps (#570)
crutch Mar 25, 2023
bda90e8
Faq order on index (#571)
crutch Mar 25, 2023
77b136c
Fix header dowpdown style for new govuk design (#573)
alhafoudh Mar 25, 2023
adef390
Bump js packages (#574)
jsuchal Mar 25, 2023
506cf57
User profile deletion (#492)
mar-vic Mar 25, 2023
a5eaac9
Add edit link to featured content in admin (#576)
mirrec Mar 25, 2023
0866d04
Add support to access Journey by URL #563 (#575)
mirrec Mar 25, 2023
98f8995
Save Upvs::Submissions to DB, Fix SVM login
luciajanikova Mar 25, 2023
05ac308
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova Mar 25, 2023
b829758
Enhance submissions cleanup process (#577)
crutch Mar 25, 2023
696ccb1
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova Mar 25, 2023
f6e772d
Fix logout
luciajanikova Mar 25, 2023
23d2c46
Fix structure.sql
luciajanikova Mar 25, 2023
4fbd6fa
Update text
luciajanikova Mar 25, 2023
b7ff425
Be able to know which Journey is outdated (#534)
mirrec Mar 25, 2023
9657399
Remove binding.pry & token from Upvs::Submission
luciajanikova Mar 25, 2023
a32962c
Law links enhancements (#579)
crutch Mar 25, 2023
17969ba
Update migration
luciajanikova Mar 27, 2023
f4bfb77
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova Mar 27, 2023
9f22d13
Rename upvs_submissions finish route
luciajanikova Mar 27, 2023
30c149e
Set expires_at
luciajanikova Mar 27, 2023
36e9b80
add invisible captcha to login (#580)
celuchmarek Mar 30, 2023
10bbc81
Add expired scope & Add upvs submissions to cleanup task
luciajanikova Apr 3, 2023
bf0c503
Merge branch 'master' into feature/save_upvs_submissions_to_db
luciajanikova Apr 3, 2023
9dd7636
Fix setting expires_at
luciajanikova Apr 3, 2023
26064f6
Bump nokogiri from 1.14.2 to 1.14.3 (#581)
dependabot[bot] Apr 13, 2023
8541540
Merge branch 'master' into feature/save_upvs_submissions_to_db
luciajanikova Apr 13, 2023
db037cb
Merge pull request #578 from slovensko-digital/feature/save_upvs_subm…
luciajanikova Apr 13, 2023
5c3c728
Merge branch 'master' into fix/empty-or-sr-acts
luciajanikova Apr 13, 2023
cf67d7f
Update index text
luciajanikova Apr 17, 2023
37e9059
Merge branch 'fix/empty-or-sr-acts' of https://github.com/slovensko-d…
luciajanikova Apr 17, 2023
fd72b53
Merge pull request #582 from slovensko-digital/fix/empty-or-sr-acts
luciajanikova Apr 17, 2023
d0d1f0a
Que monitoring implemented (#586)
Jun 27, 2023
89f808e
add require 'que/active_record/model' (#589)
celuchmarek Jun 27, 2023
fdfac94
Updated the voting app with the new election date (30th September 202…
jsuchal Jul 11, 2023
35a090b
make /usr/bin/mkdir available for installing gems into the vscode ima…
tom-m Jul 12, 2023
1b91fc6
Fix voting subscription (#595)
jsuchal Aug 9, 2023
c10b399
update autodeploy version (#596)
celuchmarek Aug 15, 2023
9855edb
Vote app enable preukaz (#594)
celuchmarek Aug 23, 2023
7164672
Fix parliament vote app email template format on some iPhones (#599)
celuchmarek Sep 11, 2023
2f88a99
revert ruby to 3.2.1 because of unsuccessful build (#601)
celuchmarek Sep 11, 2023
3a15587
ND-231 Add UPVS submission tests (#600)
celuchmarek Sep 18, 2023
569b39e
Bump puma from 6.1.1 to 6.3.1 (#597)
dependabot[bot] Oct 6, 2023
7c28a0d
Bump semver from 5.7.1 to 5.7.2 (#591)
dependabot[bot] Oct 6, 2023
f08f326
Use env variables for parliament vote app dates (#603)
celuchmarek Oct 6, 2023
77bc8be
Add missing seeds & Update existing
luciajanikova Oct 6, 2023
906fb5e
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova Oct 6, 2023
07339a9
Merge pull request #604 from slovensko-digital/update_seeds
luciajanikova Oct 6, 2023
6b97960
Finetune text for notification confirmation, closes #549 (#606)
jsuchal Oct 7, 2023
6fa5b72
Replace text xslt with html xslt
luciajanikova Oct 7, 2023
90a3319
Merge branch 'master' of https://github.com/slovensko-digital/navody.…
luciajanikova Oct 7, 2023
7a70d51
Merge pull request #607 from slovensko-digital/update_seeds
luciajanikova Oct 7, 2023
d4f757e
Add tests for category detail (#605)
mirrec Oct 7, 2023
1383a27
Add onboarding modal, refs #331 (#616)
jsuchal Oct 7, 2023
c2db554
set request body size to 50m on ingress (#629)
celuchmarek Jan 8, 2024
4d9e19e
ECO-240/improved-healthcheck (#632)
tomasdrga Jan 29, 2024
45eb0cc
Prezidentské voľby 2024 (#635)
celuchmarek Feb 8, 2024
66ea1c9
update og image for president vote app (#636)
celuchmarek Feb 8, 2024
2cf1d92
disable active topic in vote app (#637)
celuchmarek Feb 9, 2024
621afc0
update init page text (#638)
celuchmarek Mar 7, 2024
e04fd05
fix first round deadline and update homepage text (#639)
celuchmarek Mar 22, 2024
fa820b8
Merge branch 'eid-login' into feature/eid-login
cizmarty Apr 26, 2024
6fb5e03
Add login button, expect callback URL from UPVS to be always /login f…
cizmarty Apr 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
AUTH_EID_BASE_URL=
AUTH_EID_PUBLIC_KEY=
AUTH_EID_PRIVATE_KEY=

DEFAULT_EMAIL_FROM=navody@digital

Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 2.7.5
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ gem 'validate_url'
# sendinblue V3
gem 'sib-api-v3-sdk'
gem 'recaptcha'
gem 'jwt'
gem 'friendly_id'

group :development, :test do
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ DEPENDENCIES
hirb
jbuilder
jquery-rails
jwt
kaminari
letter_opener_web
listen
Expand Down
20 changes: 20 additions & 0 deletions app/assets/images/eid-card-yellow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions app/assets/images/eid-card.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions 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.
11 changes: 11 additions & 0 deletions app/controllers/eid/onboarding_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Eid
class OnboardingController < ApplicationController
def new
# TODO
end

def create
# TODO
end
end
end
Copy link
Member

@jsuchal jsuchal Jun 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tie todos asi vyhodme.

49 changes: 47 additions & 2 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@ def new
end

def create
if new_eid_identity?
session[:eid_uid] = auth_hash.uid
redirect_to new_eid_onboarding_path
return
end

redirect_to new_session_path, alert: 'Prosím zadajte e-mail' and return unless auth_email.present?

user = User.find_by('lower(email) = lower(?)', auth_email) || User.create!(email: auth_email)

if eid_identity_approval?
user.update!(eid_sub: auth_hash.info['eid_uid'])
session.delete(:eid_uid)
end

session[:user_id] = user.id
redirect_to after_login_redirect_path, notice: 'Prihlásenie úspešné. Vitajte!'
end
Expand All @@ -23,10 +34,36 @@ def failure
@strategy = params[:strategy]
end

def destroy
def logout
reset_session

redirect_to root_path, notice: 'Odhlásenie bolo úspešné.'
if params[:callback].present?
redirect_to params[:callback]

Check warning

Code scanning / CodeQL

URL redirection from remote source Medium

Untrusted URL redirection depends on a
user-provided value
.
else
redirect_to root_path, notice: 'Odhlásenie bolo úspešné.'
end
end

def destroy
eid_encoded_token = session[:eid_encoded_token]
eid_token_expires_at = session[:eid_token_expires_at].present? ? Time.zone.parse(session[:eid_token_expires_at]) : nil

if eid_encoded_token.present? && eid_token_expires_at&.future?
eid_config = Rails.application.config_for(:auth)[:eid]

eid_encoded_token = eid_encoded_token
logout_url = "#{eid_config[:base_url]}/logout"
private_key = OpenSSL::PKey::RSA.new(eid_config[:private_key])
logout_token = JWT.encode({
"exp": (Time.zone.now + 5.minutes).to_i,
"jti": SecureRandom.uuid,
"obo": eid_encoded_token,
}, private_key, 'RS256', { cty: 'JWT' })

redirect_to "#{logout_url}?token=#{logout_token}"
else
logout
end
end

protected
Expand All @@ -41,6 +78,14 @@ def auth_hash

private

def new_eid_identity?
auth_hash.provider == "eid" && auth_hash.info['email'].blank?
end

def eid_identity_approval?
auth_hash.provider == "magiclink" && auth_hash.info['eid_uid'].present?
end

def after_login_redirect_path
return session[:after_login_callback] if session[:after_login_callback]&.start_with?("/") # Only allow local redirects
root_path
Expand Down
26 changes: 26 additions & 0 deletions app/views/eid/onboarding/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<% content_for :title, build_page_title('Zadajte email k svojmu účtu') %>

<div class="govuk-grid-row govuk-!-padding-top-9">
<div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Predtým, než začnete...</span>
<h1 class="govuk-heading-l">Budeme potrebovať váš email</h1>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half">
<%= form_tag(auth_path(:magiclink), method: :post, id: 'login-email') do %>
<fieldset class="govuk-fieldset">
<div class="govuk-form-group">
<span class="govuk-label-wrapper">
<label class="govuk-label govuk-label--m">na ktorý budete dostávať upozornenia</label>
</span>
<span class="govuk-hint">
Pošleme Vám jednoduchý odkaz na overenie emailu.
</span>
<%= email_field_tag :email, nil, class: 'govuk-input', required: true %>
</div>
<%= submit_tag 'Dokončiť založenie účtu', class: 'govuk-button' %>
</fieldset>
<% end %>
</div>
</div>
14 changes: 11 additions & 3 deletions app/views/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half">
<%= form_tag(auth_path(:google_oauth2), method: :post, class: 'govuk-body govuk-!-margin-bottom-8') do %>
<div class="govuk-grid-column-one-quarter govuk-!-margin-bottom-8">
<%= form_tag(auth_path(:google_oauth2), method: :post) do %>
<%= 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 %>

</div>
<div class="govuk-grid-column-one-quarter govuk-!-margin-bottom-8">
<%= form_tag(auth_path(:eid), method: :post, id: 'login-eid') 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 %>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half">
<%= form_tag(auth_path(:magiclink), method: :post, id: 'login-email') do %>
<fieldset class="govuk-fieldset">
<div class="govuk-form-group">
Expand Down
5 changes: 5 additions & 0 deletions config/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ default: &default
sendinblue:
api_key: <%= ENV.fetch('SENDINBLUE_API_KEY', nil) %>

eid:
base_url: <%= ENV.fetch('AUTH_EID_BASE_URL', nil) %>
public_key: <%= ENV.fetch('AUTH_EID_PUBLIC_KEY', nil).inspect %>
private_key: <%= ENV.fetch('AUTH_EID_PRIVATE_KEY', nil).inspect %>

development:
<<: *default

Expand Down
6 changes: 6 additions & 0 deletions config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require 'omniauth/strategies/magic_link'
require 'omniauth/strategies/eid'

OmniAuth.config.logger = Rails.logger
OmniAuth.config.failure_raise_out_environments = []

Expand All @@ -12,5 +14,9 @@
UserMailer.with(email: email, token: token).magic_link.deliver_later
}
}
provider :eid, {
base_url: Rails.application.config_for(:auth).dig(:eid, :base_url),
public_key: Rails.application.config_for(:auth).dig(:eid, :public_key),
}
end

2 changes: 1 addition & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 1 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count

Expand Down
6 changes: 6 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
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: :eid_auth_callback # TODO: add constraint for origin check
get 'logout', to: 'sessions#logout', as: :eid_deauth_callback # TODO: add constraint for origin check
namespace :eid do
resources :onboarding, only: [:new, :create]
end

resources :faqs, path: 'casto-kladene-otazky'
resources :pages, path: '', only: 'show'
resources :feedbacks, path: 'spatna-vazba'
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20220407131258_add_eid_sub_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddEidSubToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :eid_sub, :string, null: true
add_index :users, :eid_sub
end
end
13 changes: 11 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ CREATE TABLE public.users (
id bigint NOT NULL,
email text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
updated_at timestamp without time zone NOT NULL,
eid_sub character varying
);


Expand Down Expand Up @@ -1378,6 +1379,13 @@ CREATE INDEX index_user_tasks_on_task_id ON public.user_tasks USING btree (task_
CREATE INDEX index_user_tasks_on_user_step_id ON public.user_tasks USING btree (user_step_id);


--
-- Name: index_users_on_eid_sub; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_users_on_eid_sub ON public.users USING btree (eid_sub);


--
-- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -1633,6 +1641,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20210321172132'),
('20210321181737'),
('20220322180237'),
('20220323214831');
('20220323214831'),
('20220407131258');


Loading