lato 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +95 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/config/lato_manifest.js +5 -0
  6. data/app/assets/images/lato/user-150x150.jpg +0 -0
  7. data/app/assets/images/lato/user-300x300.jpg +0 -0
  8. data/app/assets/images/lato/user-600x600.jpg +0 -0
  9. data/app/assets/images/lato/user-900x900.jpg +0 -0
  10. data/app/assets/javascripts/lato/application.js +6 -0
  11. data/app/assets/javascripts/lato/controllers/application.js +9 -0
  12. data/app/assets/javascripts/lato/controllers/index.js +11 -0
  13. data/app/assets/javascripts/lato/controllers/lato_action_controller.js +92 -0
  14. data/app/assets/javascripts/lato/controllers/lato_aside_opener_controller.js +21 -0
  15. data/app/assets/javascripts/lato/controllers/lato_feedback_controller.js +13 -0
  16. data/app/assets/javascripts/lato/controllers/lato_form_controller.js +60 -0
  17. data/app/assets/javascripts/lato/controllers/lato_hello_controller.js +12 -0
  18. data/app/assets/javascripts/lato/controllers/lato_operation_controller.js +24 -0
  19. data/app/assets/stylesheets/lato/application.scss +73 -0
  20. data/app/controllers/concerns/lato/componentable.rb +52 -0
  21. data/app/controllers/concerns/lato/layoutable.rb +27 -0
  22. data/app/controllers/concerns/lato/sessionable.rb +45 -0
  23. data/app/controllers/lato/account_controller.rb +82 -0
  24. data/app/controllers/lato/application_controller.rb +21 -0
  25. data/app/controllers/lato/authentication_controller.rb +121 -0
  26. data/app/controllers/lato/operations_controller.rb +23 -0
  27. data/app/helpers/lato/application_helper.rb +5 -0
  28. data/app/helpers/lato/components_helper.rb +183 -0
  29. data/app/jobs/lato/application_job.rb +59 -0
  30. data/app/mailers/lato/application_mailer.rb +6 -0
  31. data/app/mailers/lato/user_mailer.rb +23 -0
  32. data/app/models/lato/application_record.rb +5 -0
  33. data/app/models/lato/operation.rb +96 -0
  34. data/app/models/lato/session.rb +36 -0
  35. data/app/models/lato/user.rb +164 -0
  36. data/app/views/lato/account/_alert-accepted-privacy-policy-version.html.erb +20 -0
  37. data/app/views/lato/account/_alert-accepted-terms-and-conditions-version.html.erb +20 -0
  38. data/app/views/lato/account/_form-destroy.html.erb +21 -0
  39. data/app/views/lato/account/_form-password.html.erb +28 -0
  40. data/app/views/lato/account/_form-user.html.erb +40 -0
  41. data/app/views/lato/account/index.html.erb +65 -0
  42. data/app/views/lato/authentication/_form-recover-password.html.erb +20 -0
  43. data/app/views/lato/authentication/_form-signin.html.erb +31 -0
  44. data/app/views/lato/authentication/_form-signup.html.erb +47 -0
  45. data/app/views/lato/authentication/_form-update-password.html.erb +30 -0
  46. data/app/views/lato/authentication/_form-verify-email.html.erb +22 -0
  47. data/app/views/lato/authentication/recover_password.html.erb +13 -0
  48. data/app/views/lato/authentication/signin.html.erb +13 -0
  49. data/app/views/lato/authentication/signout.html.erb +11 -0
  50. data/app/views/lato/authentication/signup.html.erb +13 -0
  51. data/app/views/lato/authentication/update_password.html.erb +13 -0
  52. data/app/views/lato/authentication/verify_email.html.erb +7 -0
  53. data/app/views/lato/components/_index.html.erb +89 -0
  54. data/app/views/lato/components/_navbar_nav_item.html.erb +5 -0
  55. data/app/views/lato/components/_operation.html.erb +68 -0
  56. data/app/views/lato/components/_page_head.html.erb +15 -0
  57. data/app/views/lato/components/_sidebar_nav_item.html.erb +5 -0
  58. data/app/views/lato/mailer/user/email_verification_mail.html.erb +9 -0
  59. data/app/views/lato/mailer/user/password_update_mail.html.erb +9 -0
  60. data/app/views/lato/operations/show.html.erb +3 -0
  61. data/app/views/layouts/lato/_action.html.erb +17 -0
  62. data/app/views/layouts/lato/_aside-opener.html.erb +7 -0
  63. data/app/views/layouts/lato/_content.html.erb +5 -0
  64. data/app/views/layouts/lato/_feedbacks.html.erb +16 -0
  65. data/app/views/layouts/lato/_footer.html.erb +11 -0
  66. data/app/views/layouts/lato/_mailer-foot_content.html.erb +2 -0
  67. data/app/views/layouts/lato/_mailer-head_content.html.erb +2 -0
  68. data/app/views/layouts/lato/_navbar-brand_content.html.erb +1 -0
  69. data/app/views/layouts/lato/_navbar-nav_content.html.erb +15 -0
  70. data/app/views/layouts/lato/_navbar.html.erb +16 -0
  71. data/app/views/layouts/lato/_sidebar-nav_content.html.erb +3 -0
  72. data/app/views/layouts/lato/_sidebar.html.erb +5 -0
  73. data/app/views/layouts/lato/application.html.erb +44 -0
  74. data/app/views/layouts/lato/mailer.html.erb +3 -0
  75. data/config/importmap.rb +8 -0
  76. data/config/locales/it.yml +235 -0
  77. data/config/routes.rb +35 -0
  78. data/db/migrate/20221022205744_create_lato_users.rb +14 -0
  79. data/db/migrate/20221118072130_create_lato_operations.rb +14 -0
  80. data/lib/lato/btstrap.rb +36 -0
  81. data/lib/lato/config.rb +39 -0
  82. data/lib/lato/engine.rb +13 -0
  83. data/lib/lato/version.rb +3 -0
  84. data/lib/lato.rb +27 -0
  85. data/lib/tasks/lato_tasks.rake +28 -0
  86. metadata +199 -0
@@ -0,0 +1,164 @@
1
+ module Lato
2
+ class User < ApplicationRecord
3
+ has_secure_password
4
+
5
+ # Kredis
6
+ ##
7
+
8
+ kredis_boolean :email_verification_semaphore, expires_in: 2.minutes
9
+ kredis_string :email_verification_code, expires_in: 30.minutes
10
+ kredis_string :password_update_code, expires_in: 30.minutes
11
+
12
+ # Validations
13
+ ##
14
+
15
+ validates :first_name, presence: true
16
+ validates :last_name, presence: true
17
+ validates :email, presence: true, uniqueness: true
18
+ validates :accepted_privacy_policy_version, presence: true
19
+ validates :accepted_terms_and_conditions_version, presence: true
20
+
21
+ # Relations
22
+ ##
23
+
24
+ has_many :lato_operations, class_name: 'Lato::Operation', foreign_key: :lato_user_id, dependent: :nullify
25
+
26
+ # Hooks
27
+ ##
28
+
29
+ before_validation do
30
+ self.email = email&.downcase&.strip
31
+ end
32
+
33
+ before_save do
34
+ self.email_verified_at = nil if email_changed?
35
+ self.accepted_privacy_policy_version = Lato.config.legal_privacy_policy_version if accepted_privacy_policy_version_changed?
36
+ self.accepted_terms_and_conditions_version = Lato.config.legal_terms_and_conditions_version if accepted_terms_and_conditions_version_changed?
37
+ end
38
+
39
+ # Questions
40
+ ##
41
+
42
+ def valid_accepted_privacy_policy_version?
43
+ @valid_accepted_privacy_policy_version ||= accepted_privacy_policy_version >= Lato.config.legal_privacy_policy_version
44
+ end
45
+
46
+ def valid_accepted_terms_and_conditions_version?
47
+ @valid_accepted_terms_and_conditions_version ||= accepted_terms_and_conditions_version >= Lato.config.legal_privacy_policy_version
48
+ end
49
+
50
+ # Helpers
51
+ ##
52
+
53
+ def full_name
54
+ "#{last_name} #{first_name}"
55
+ end
56
+
57
+ # Operations
58
+ ##
59
+
60
+ def signin(params)
61
+ self.email = params[:email]
62
+
63
+ user = Lato::User.find_by(email: params[:email])
64
+ unless user
65
+ errors.add(:email, 'non valido')
66
+ return
67
+ end
68
+
69
+ unless user.authenticate(params[:password])
70
+ errors.add(:password, 'non valida')
71
+ return
72
+ end
73
+
74
+ self.id = user.id
75
+ reload
76
+
77
+ true
78
+ end
79
+
80
+ def request_verify_email
81
+ if email_verification_semaphore.value
82
+ errors.add(:base, 'Attendi almeno 2 minuti per provare un nuovo tentativo di verifica email')
83
+ return
84
+ end
85
+
86
+ code = SecureRandom.hex.upcase
87
+ delivery = Lato::UserMailer.email_verification_mail(id, code).deliver_now
88
+ unless delivery
89
+ errors.add(:base, 'Impossibile inviare mail')
90
+ return
91
+ end
92
+
93
+ email_verification_code.value = code
94
+ email_verification_semaphore.value = true
95
+
96
+ true
97
+ end
98
+
99
+ def verify_email(params)
100
+ unless email_verification_code.value
101
+ errors.add(:base, 'Il codice di verifica email risulta scaduto')
102
+ return
103
+ end
104
+
105
+ unless email_verification_code.value == params[:code]
106
+ errors.add(:base, 'Il codice di verifica email non risulta valido')
107
+ return
108
+ end
109
+
110
+ email_verification_code.value = nil
111
+ email_verification_semaphore.value = nil
112
+
113
+ update_column(:email_verified_at, Time.now)
114
+ true
115
+ end
116
+
117
+ def destroy_with_confirmation(params)
118
+ unless params[:email_confirmation] == email
119
+ errors.add(:email, 'non corretto')
120
+ return
121
+ end
122
+
123
+ destroy
124
+ end
125
+
126
+ def request_recover_password(params)
127
+ user = Lato::User.find_by(email: params[:email])
128
+ unless user
129
+ errors.add(:email, 'non registrato')
130
+ return
131
+ end
132
+
133
+ code = SecureRandom.hex.upcase
134
+ delivery = Lato::UserMailer.password_update_mail(user.id, code).deliver_now
135
+ unless delivery
136
+ errors.add(:base, 'Impossibile inviare mail')
137
+ return
138
+ end
139
+
140
+ self.id = user.id
141
+ reload
142
+
143
+ password_update_code.value = code
144
+
145
+ true
146
+ end
147
+
148
+ def update_password(params)
149
+ unless password_update_code.value
150
+ errors.add(:base, 'Il codice di verifica risulta scaduto')
151
+ return
152
+ end
153
+
154
+ unless password_update_code.value == params[:code]
155
+ errors.add(:base, 'Il codice di verifica non risulta valido')
156
+ return
157
+ end
158
+
159
+ password_update_code.value = nil
160
+
161
+ update(params.permit(:password, :password_confirmation))
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,20 @@
1
+ <%= turbo_frame_tag 'account_alert-accepted-privacy-policy-version' do %>
2
+ <% unless @session.user.valid_accepted_privacy_policy_version? %>
3
+ <div class="alert alert-info mb-4">
4
+ <h2 class="alert-heading">Aggiornamento privacy policy</h2>
5
+ <p>
6
+ Ciao <%= @session.user.first_name %>,<br>
7
+ Ti informiamo che è stato rilasciato un <b>aggiornamento della nostra privacy policy</b>.<br>
8
+ Per continuare a utilizzare <%= Lato.config.application_title %> è necessario prendere visione e accettare la nuova privacy policy.<br>
9
+ </p>
10
+ <%= form_with model: @session.user, url: lato.account_update_accepted_privacy_policy_version_action_path, data: { turbo_frame: '_self' } do |form| %>
11
+ <%= lato_form_errors @session.user, class: %w[mb-3] %>
12
+ <%= lato_form_item_input_check form, :accepted_privacy_policy_version, "Dichiaro di aver letto e accettato la <a href=#{Lato.config.legal_privacy_policy_url} target=_blank>privacy policy</a>.", checked: false, required: true %>
13
+
14
+ <div class="mt-3">
15
+ <%= lato_form_submit form, 'Conferma' %>
16
+ </div>
17
+ <% end %>
18
+ </div>
19
+ <% end %>
20
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <%= turbo_frame_tag 'account_alert-accepted-terms-and-conditions-version' do %>
2
+ <% unless @session.user.valid_accepted_terms_and_conditions_version? %>
3
+ <div class="alert alert-info mb-4">
4
+ <h2 class="alert-heading">Aggiornamento termini e condizioni</h2>
5
+ <p>
6
+ Ciao <%= @session.user.first_name %>,<br>
7
+ Ti informiamo che è stato rilasciato un <b>aggiornamento dei nostri termini e condizioni</b> di utilizzo.<br>
8
+ Per continuare a utilizzare <%= Lato.config.application_title %> è necessario prendere visione e accettare i nuovi termini.<br>
9
+ </p>
10
+ <%= form_with model: @session.user, url: lato.account_update_accepted_terms_and_conditions_version_action_path, data: { turbo_frame: '_self' } do |form| %>
11
+ <%= lato_form_errors @session.user, class: %w[mb-3] %>
12
+ <%= lato_form_item_input_check form, :accepted_terms_and_conditions_version, "Dichiaro di aver letto e accettato i <a href=#{Lato.config.legal_terms_and_conditions_url} target=_blank>termini e condizioni</a> di utilizzo.", checked: false, required: true %>
13
+
14
+ <div class="mt-3">
15
+ <%= lato_form_submit form, 'Conferma' %>
16
+ </div>
17
+ <% end %>
18
+ </div>
19
+ <% end %>
20
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <%
2
+
3
+ user ||= Lato::User.new
4
+
5
+ %>
6
+
7
+ <%= turbo_frame_tag 'account_form-destroy' do %>
8
+ <%= form_with model: user, url: lato.account_destroy_action_path, method: :delete, data: { turbo_frame: '_self', controller: 'lato-form' } do |form| %>
9
+ <%= lato_form_notices class: %w[mb-3] %>
10
+ <%= lato_form_errors user, class: %w[mb-3] %>
11
+
12
+ <div class="mb-3">
13
+ <%= lato_form_item_label form, :email_confirmation, 'Indirizzo email di registrazione' %>
14
+ <%= lato_form_item_input_email form, :email_confirmation, required: true %>
15
+ </div>
16
+
17
+ <div class="d-flex justify-content-end">
18
+ <%= lato_form_submit form, 'Elimina account', class: %w[btn-danger] %>
19
+ </div>
20
+ <% end %>
21
+ <% end %>
@@ -0,0 +1,28 @@
1
+ <%
2
+
3
+ user ||= Lato::User.new
4
+
5
+ %>
6
+
7
+ <%= turbo_frame_tag 'account_form-password' do %>
8
+ <%= form_with model: user, url: lato.account_update_password_action_path, data: { turbo_frame: '_self', controller: 'lato-form' } do |form| %>
9
+ <%= lato_form_notices class: %w[mb-3] %>
10
+ <%= lato_form_errors user, class: %w[mb-3] %>
11
+
12
+ <div class="row">
13
+ <div class="col col-12 col-lg-6 mb-3">
14
+ <%= lato_form_item_label form, :password, 'Nuova password' %>
15
+ <%= lato_form_item_input_password form, :password, required: true %>
16
+ </div>
17
+
18
+ <div class="col col-12 col-lg-6 mb-3">
19
+ <%= lato_form_item_label form, :password_confirmation, 'Conferma nuova password' %>
20
+ <%= lato_form_item_input_password form, :password_confirmation, required: true %>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="d-flex justify-content-end">
25
+ <%= lato_form_submit form, 'Aggiorna', class: %w[btn-success] %>
26
+ </div>
27
+ <% end %>
28
+ <% end %>
@@ -0,0 +1,40 @@
1
+ <%
2
+
3
+ user ||= Lato::User.new
4
+
5
+ %>
6
+
7
+ <%= turbo_frame_tag 'account_form-user' do %>
8
+ <%= form_with model: user, url: lato.account_update_user_action_path, data: { turbo_frame: '_self', controller: 'lato-form' } do |form| %>
9
+ <%= lato_form_notices class: %w[mb-3] %>
10
+ <%= lato_form_errors user, class: %w[mb-3] %>
11
+
12
+ <div class="row">
13
+ <div class="col col-12 col-lg-4 mb-3">
14
+ <%= lato_form_item_label form, :first_name %>
15
+ <%= lato_form_item_input_text form, :first_name, required: true %>
16
+ </div>
17
+
18
+ <div class="col col-12 col-lg-4 mb-3">
19
+ <%= lato_form_item_label form, :last_name %>
20
+ <%= lato_form_item_input_text form, :last_name, required: true %>
21
+ </div>
22
+
23
+ <div class="col col-12 col-lg-4 mb-3">
24
+ <%= lato_form_item_label form, :email %>
25
+ <div class="input-group mb-3">
26
+ <%= lato_form_item_input_email form, :email, required: true %>
27
+ <% if user.email_verified_at %>
28
+ <button class="btn btn-outline-success" style="pointer-events: none">Verificato</span>
29
+ <% else %>
30
+ <%= link_to 'Verifica email', account_request_verify_email_action_path, class: 'btn btn-warning', data: { turbo_method: :patch, turbo_frame: '_self' } %>
31
+ <% end %>
32
+ </div>
33
+ </div>
34
+ </div>
35
+
36
+ <div class="d-flex justify-content-end">
37
+ <%= lato_form_submit form, 'Aggiorna', class: %w[btn-success] %>
38
+ </div>
39
+ <% end %>
40
+ <% end %>
@@ -0,0 +1,65 @@
1
+ <%= lato_page_head 'Account' %>
2
+
3
+ <%= render 'lato/account/alert-accepted-privacy-policy-version' %>
4
+ <%= render 'lato/account/alert-accepted-terms-and-conditions-version' %>
5
+
6
+ <div class="card mb-4">
7
+ <div class="card-header">
8
+ <h2 class="fs-4 mb-0">Informazioni account</h2>
9
+ </div>
10
+ <div class="card-body">
11
+ <%= render 'lato/account/form-user', user: @session.user %>
12
+ </div>
13
+ </div>
14
+
15
+ <% if false %>
16
+ <div class="card mb-4">
17
+ <div class="card-header">
18
+ <h2 class="fs-4 mb-0">Dati di fatturazione</h2>
19
+ </div>
20
+ <div class="card-body">
21
+
22
+ </div>
23
+ </div>
24
+ <% end %>
25
+
26
+ <div class="card mb-4">
27
+ <div class="card-header">
28
+ <h2 class="fs-4 mb-0">Aggiornamento password</h2>
29
+ </div>
30
+ <div class="card-body">
31
+ <%= render 'lato/account/form-password', user: @session.user %>
32
+ </div>
33
+ </div>
34
+
35
+
36
+ <% if false %>
37
+ <div class="card mb-4">
38
+ <div class="card-header">
39
+ <h2 class="fs-4 mb-0">Chiavi API</h2>
40
+ </div>
41
+ <div class="card-body">
42
+
43
+ </div>
44
+ </div>
45
+ <% end %>
46
+
47
+ <div class="card mb-4">
48
+ <div class="card-header">
49
+ <h2 class="fs-4 mb-0">Cancellazione account</h2>
50
+ </div>
51
+ <div class="card-body">
52
+ <div class="alert alert-warning">
53
+ <h4 class="alert-heading">Attenzione</h4>
54
+ <p>
55
+ Cancellando il tuo account <b>saranno automaticamente eliminati definitivamente tutti i dati</b> ad esso associati.<br>
56
+ Confermando l'eliminazione non ci sarà più modo di recuperare le informazioni perse.
57
+ </p>
58
+ <p class="mb-0">
59
+ Digita il tuo indirizzo email di registrazione e premi "Elimina account" per procedere con l'operazione.
60
+ </p>
61
+ </div>
62
+
63
+ <%= render 'lato/account/form-destroy', user: @session.user %>
64
+ </div>
65
+ </div>
@@ -0,0 +1,20 @@
1
+ <%
2
+
3
+ user ||= Lato::User.new
4
+
5
+ %>
6
+
7
+ <%= turbo_frame_tag 'authentication_form-recover-password' do %>
8
+ <%= form_with model: user, url: lato.authentication_recover_password_action_path, data: { turbo_frame: '_self', controller: 'lato-form' } do |form| %>
9
+ <%= lato_form_errors user, class: %w[mb-3] %>
10
+
11
+ <div class="mb-3">
12
+ <%= lato_form_item_label form, :email, 'Inserisci la tua email' %>
13
+ <%= lato_form_item_input_email form, :email, required: true %>
14
+ </div>
15
+
16
+ <div>
17
+ <%= lato_form_submit form, 'Prosegui', class: %w[d-block w-100] %>
18
+ </div>
19
+ <% end %>
20
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <%
2
+
3
+ user ||= Lato::User.new
4
+
5
+ %>
6
+
7
+ <%= turbo_frame_tag 'authentication_form-signin' do %>
8
+ <%= form_with model: user, url: lato.authentication_signin_action_path, data: { turbo_frame: '_self', controller: 'lato-form' } do |form| %>
9
+ <%= lato_form_notices class: %w[mb-3] %>
10
+ <%= lato_form_errors user, class: %w[mb-3] %>
11
+
12
+ <div class="mb-3">
13
+ <%= lato_form_item_label form, :email, 'Email' %>
14
+ <%= lato_form_item_input_email form, :email, required: true %>
15
+ </div>
16
+
17
+ <div class="mb-3">
18
+ <%= lato_form_item_label form, :password, 'Password' %>
19
+ <%= lato_form_item_input_password form, :password, required: true %>
20
+ </div>
21
+
22
+ <div>
23
+ <%= lato_form_submit form, 'Accedi', class: %w[d-block w-100] %>
24
+ </div>
25
+ <% unless Lato.config.auth_disable_signup %>
26
+ <div class="text-center mt-3 mb-3">
27
+ oppure <%= link_to 'crea un account gratuito', lato.authentication_signup_path %>
28
+ </div>
29
+ <% end %>
30
+ <% end %>
31
+ <% end %>
@@ -0,0 +1,47 @@
1
+ <%
2
+
3
+ user ||= Lato::User.new
4
+
5
+ %>
6
+
7
+ <%= turbo_frame_tag 'authentication_form-signup' do %>
8
+ <%= form_with model: user, url: lato.authentication_signup_action_path, data: { turbo_frame: '_self', controller: 'lato-form' } do |form| %>
9
+ <%= lato_form_errors user, class: %w[mb-3] %>
10
+
11
+ <div class="row">
12
+ <div class="col col-12 col-md-6 mb-3">
13
+ <%= lato_form_item_label form, :first_name, 'Nome' %>
14
+ <%= lato_form_item_input_text form, :first_name, required: true %>
15
+ </div>
16
+
17
+ <div class="col col-12 col-md-6 mb-3">
18
+ <%= lato_form_item_label form, :last_name, 'Cognome' %>
19
+ <%= lato_form_item_input_text form, :last_name, required: true %>
20
+ </div>
21
+
22
+ <div class="col col-12 mb-3">
23
+ <%= lato_form_item_label form, :email, 'Email' %>
24
+ <%= lato_form_item_input_email form, :email, required: true %>
25
+ </div>
26
+
27
+ <div class="col col-12 col-md-6 mb-3">
28
+ <%= lato_form_item_label form, :password, 'Password' %>
29
+ <%= lato_form_item_input_password form, :password, required: true %>
30
+ </div>
31
+
32
+ <div class="col col-12 col-md-6 mb-3">
33
+ <%= lato_form_item_label form, :password_confirmation, 'Conferma password' %>
34
+ <%= lato_form_item_input_password form, :password_confirmation, required: true %>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="mb-3 text-muted" style="font-size: 14px;">
39
+ <%= lato_form_item_input_check form, :accepted_privacy_policy_version, "Dichiaro di aver letto e accettato la <a href=#{Lato.config.legal_privacy_policy_url} target=_blank>privacy policy</a>.", required: true %>
40
+ <%= lato_form_item_input_check form, :accepted_terms_and_conditions_version, "Dichiaro di aver letto e accettato i <a href=#{Lato.config.legal_terms_and_conditions_url} target=_blank>termini e condizioni</a> di utilizzo.", required: true %>
41
+ </div>
42
+
43
+ <div class="d-flex justify-content-end">
44
+ <%= lato_form_submit form, 'Registrati' %>
45
+ </div>
46
+ <% end %>
47
+ <% end %>
@@ -0,0 +1,30 @@
1
+ <%
2
+
3
+ user ||= Lato::User.new
4
+
5
+ %>
6
+
7
+ <%= turbo_frame_tag 'authentication_form-update-password' do %>
8
+ <%= form_with model: user, url: lato.authentication_update_password_action_path(id: user.id), data: { turbo_frame: '_self', controller: 'lato-form' } do |form| %>
9
+ <%= lato_form_errors user, class: %w[mb-3] %>
10
+
11
+ <div class="mb-3">
12
+ <%= lato_form_item_label form, :code, 'Codice ricevuto via email' %>
13
+ <%= lato_form_item_input_text form, :code, required: true %>
14
+ </div>
15
+
16
+ <div class="mb-3">
17
+ <%= lato_form_item_label form, :password, 'Nuova password' %>
18
+ <%= lato_form_item_input_password form, :password, required: true %>
19
+ </div>
20
+
21
+ <div class="mb-3">
22
+ <%= lato_form_item_label form, :password_confirmation, 'Conferma nuova password' %>
23
+ <%= lato_form_item_input_password form, :password_confirmation, required: true %>
24
+ </div>
25
+
26
+ <div class="d-flex justify-content-end">
27
+ <%= lato_form_submit form, 'Conferma' %>
28
+ </div>
29
+ <% end %>
30
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <%
2
+
3
+ user ||= Lato::User.new
4
+ code ||= nil
5
+
6
+ %>
7
+
8
+
9
+ <%= turbo_frame_tag 'authentication_form_verify_email' do %>
10
+ <%= form_with model: user, url: lato.authentication_verify_email_action_path(id: user.id), class: 'text-center', data: { turbo_frame: '_self' } do |form| %>
11
+ <% if code %>
12
+ <%= form.hidden_field :code, value: code %>
13
+ <button type="submit" style="display: none;"></button>
14
+ <script>document.getElementById('authentication_form_verify_email').querySelector('button[type="submit"]').click()</script>
15
+ <% else %>
16
+ <%= lato_form_notices class: %w[mb-3], fixed: true %>
17
+ <%= lato_form_errors user, class: %w[mb-3], fixed: true %>
18
+
19
+ <%= link_to 'Torna all tuo account', lato.account_path, class: %w[btn btn-primary] %>
20
+ <% end %>
21
+ <% end %>
22
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <div class="w-100 h-100 d-flex justify-content-center align-items-center" style="min-height: calc(100vh - 54px - 2rem)">
2
+ <div class="card w-100" style="max-width: 400px">
3
+ <div class="card-header">
4
+ <h1 class="fs-3 mb-0 text-center">Recupero password</h1>
5
+ </div>
6
+ <div class="card-body">
7
+ <%= render 'lato/authentication/form-recover-password', user: @user %>
8
+ </div>
9
+ <div class="card-footer text-center">
10
+ <%= link_to 'Torna al login', lato.authentication_signin_path, class: 'text-muted' %>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,13 @@
1
+ <div class="w-100 h-100 d-flex justify-content-center align-items-center" style="min-height: calc(100vh - 54px - 2rem)">
2
+ <div class="card w-100" style="max-width: 400px">
3
+ <div class="card-header">
4
+ <h1 class="fs-3 mb-0 text-center">Accedi</h1>
5
+ </div>
6
+ <div class="card-body">
7
+ <%= render 'lato/authentication/form-signin', user: @user %>
8
+ </div>
9
+ <div class="card-footer text-center">
10
+ <%= link_to 'Hai dimenticato la password?', lato.authentication_recover_password_path, class: 'text-muted' %>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,11 @@
1
+ <div class="w-100 h-100 d-flex justify-content-center align-items-center" style="min-height: calc(100vh - 54px - 2rem)">
2
+ <div class="card w-100" style="max-width: 350px">
3
+ <div class="card-body text-center">
4
+ <p><%= @session.user.first_name %>, Sei sicuro di voler uscire dal tuo account?</p>
5
+ <div>
6
+ <%= link_to 'Annulla', lato.root_path, class: %w[btn btn-primary me-2] %>
7
+ <%= link_to 'Si, Esci', lato.authentication_signout_action_path, class: %w[btn btn-danger ms-2], data: { turbo_method: :delete } %>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ </div>
@@ -0,0 +1,13 @@
1
+ <div class="w-100 h-100 d-flex justify-content-center align-items-center" style="min-height: calc(100vh - 54px - 2rem)">
2
+ <div class="card w-100" style="max-width: 550px">
3
+ <div class="card-header">
4
+ <h1 class="fs-3 mb-0 text-center">Registrati</h1>
5
+ </div>
6
+ <div class="card-body">
7
+ <%= render 'lato/authentication/form-signup', user: @user %>
8
+ </div>
9
+ <div class="card-footer">
10
+ <%= link_to 'Hai già un account?', lato.authentication_signin_path, class: 'text-muted' %>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,13 @@
1
+ <div class="w-100 h-100 d-flex justify-content-center align-items-center" style="min-height: calc(100vh - 54px - 2rem)">
2
+ <div class="card w-100" style="max-width: 400px">
3
+ <div class="card-header">
4
+ <h1 class="fs-3 mb-0 text-center">Aggiornamento password</h1>
5
+ </div>
6
+ <div class="card-body">
7
+ <%= render 'lato/authentication/form-update-password', user: @user %>
8
+ </div>
9
+ <div class="card-footer text-center">
10
+ <%= link_to 'Torna al login', lato.authentication_signin_path, class: 'text-muted' %>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,7 @@
1
+ <div class="w-100 h-100 d-flex justify-content-center align-items-center" style="min-height: calc(100vh - 54px - 2rem)">
2
+ <div class="card w-100" style="max-width: 350px">
3
+ <div class="card-body">
4
+ <%= render 'lato/authentication/form-verify-email', user: @user, code: @code %>
5
+ </div>
6
+ </div>
7
+ </div>