lato 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f403e8807c165027e5eb53e21b340bbc3008d4109e63f6cad74ae3960e04efb
4
- data.tar.gz: 8862715e36ef3e00ff0a732c4b5da401811bc731fdceca688c9daf514b643e6b
3
+ metadata.gz: ad4feff73a5b285980cad936d0fee7d95760fb60849a99bd0c3d0176142e3a21
4
+ data.tar.gz: 3adc8605691d718271b8d166e6ed47117a8c18c608087b90cbec8695c1cbf2be
5
5
  SHA512:
6
- metadata.gz: 416723f51c87c0c5591c0ed691a45fcd52f61a2c8970ff68155dbb866933eba6e5101a39a7a98b5a37906e363302d7fbac7b45fcda819fb1789246016a0ec4c8
7
- data.tar.gz: dbd3d0cae8f7a5315b718cea57dd2d543b6dbd28d0b911b3ebdb102fd75dcb6e9fb0a31fcd0a97dfc4095932400152055518d4c2109c9366a74f28c7d77d2699
6
+ metadata.gz: 4eb0a4e4238e1785feaff6835fa58a23d5005ec42f3e089ad78b9ad4bb5acc1ec23d20a845a092857178fa25081ed9191880b248c4cfc0af24447af9032de3ec
7
+ data.tar.gz: a679295a0941f082ebb1a51c836a22c23f9a75a43484797f05842f0f8bc871a417555d0cfcb3b27992656c3019fc5afb160a729a7af8d921ce89d1ad2552e80e
@@ -57,7 +57,7 @@ module Lato
57
57
 
58
58
  def update_accepted_privacy_policy_version_action
59
59
  respond_to do |format|
60
- if @session.user.update(params.require(:user).permit(:accepted_privacy_policy_version))
60
+ if @session.user.update_accepted_privacy_policy_version(params.require(:user).permit(:confirm))
61
61
  format.html { redirect_to lato.account_path }
62
62
  format.json { render json: @session.user }
63
63
  else
@@ -69,7 +69,7 @@ module Lato
69
69
 
70
70
  def update_accepted_terms_and_conditions_version_action
71
71
  respond_to do |format|
72
- if @session.user.update(params.require(:user).permit(:accepted_terms_and_conditions_version))
72
+ if @session.user.update_accepted_terms_and_conditions_version(params.require(:user).permit(:confirm))
73
73
  format.html { redirect_to lato.account_path }
74
74
  format.json { render json: @session.user }
75
75
  else
@@ -46,7 +46,7 @@ module Lato
46
46
  end
47
47
 
48
48
  def valid_accepted_terms_and_conditions_version?
49
- @valid_accepted_terms_and_conditions_version ||= accepted_terms_and_conditions_version >= Lato.config.legal_privacy_policy_version
49
+ @valid_accepted_terms_and_conditions_version ||= accepted_terms_and_conditions_version >= Lato.config.legal_terms_and_conditions_version
50
50
  end
51
51
 
52
52
  # Helpers
@@ -162,5 +162,23 @@ module Lato
162
162
 
163
163
  update(params.permit(:password, :password_confirmation))
164
164
  end
165
+
166
+ def update_accepted_privacy_policy_version(params)
167
+ unless params[:confirm]
168
+ errors.add(:base, 'Per accettare la privacy policy devi selezionare la checkbox di conferma')
169
+ return
170
+ end
171
+
172
+ update(accepted_privacy_policy_version: Lato.config.legal_privacy_policy_version)
173
+ end
174
+
175
+ def update_accepted_terms_and_conditions_version(params)
176
+ unless params[:confirm]
177
+ errors.add(:base, 'Per accettare i termini e condizioni devi selezionare la checkbox di conferma')
178
+ return
179
+ end
180
+
181
+ update(accepted_terms_and_conditions_version: Lato.config.legal_terms_and_conditions_version)
182
+ end
165
183
  end
166
184
  end
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
  <%= form_with model: @session.user, url: lato.account_update_accepted_privacy_policy_version_action_path, data: { turbo_frame: '_self' } do |form| %>
11
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, value: Lato.config.legal_privacy_policy_version, required: true %>
12
+ <%= lato_form_item_input_check form, :confirm, "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
13
 
14
14
  <div class="mt-3">
15
15
  <%= lato_form_submit form, 'Conferma' %>
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
  <%= form_with model: @session.user, url: lato.account_update_accepted_terms_and_conditions_version_action_path, data: { turbo_frame: '_self' } do |form| %>
11
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, value: Lato.config.legal_terms_and_conditions_version, required: true %>
12
+ <%= lato_form_item_input_check form, :confirm, "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
13
 
14
14
  <div class="mt-3">
15
15
  <%= lato_form_submit form, 'Conferma' %>
data/lib/lato/config.rb CHANGED
@@ -36,9 +36,9 @@ module Lato
36
36
  @email_from = 'lato@example.com'
37
37
 
38
38
  @legal_privacy_policy_url = '#'
39
- @legal_privacy_policy_version = 1
39
+ @legal_privacy_policy_version = 3
40
40
  @legal_terms_and_conditions_url = '#'
41
- @legal_terms_and_conditions_version = 1
41
+ @legal_terms_and_conditions_version = 2
42
42
  end
43
43
  end
44
44
  end
data/lib/lato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "0.1.18"
2
+ VERSION = "0.1.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante