decidim-verify_wo_registration 0.1.0 → 0.3.0

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: 5591c6786a6b868acab83dda9fb1617ce216abb8e38eeec9e6a69e0780feb44a
4
- data.tar.gz: 0bc507423086d5f268420349b8b5f29ed7ce0c38dc87feb182c0438490fa4d3a
3
+ metadata.gz: 486bb5c7e9ca2ebf28cf1d3f8d9c3b1deb4ecd5b6fbfc7281d49e80ae0c181dd
4
+ data.tar.gz: 301ba70919cc284dbcee731121e3065a594fbf3cfc8e7674e315d2012c80e89e
5
5
  SHA512:
6
- metadata.gz: 6c22ded2aa0c47e74f5ef3ae33c8429c1d646e05bee45870e4d45a08e1bab5e53d7bb51bb48ef7bc38d1af5cc007cf1b643b033f02a506ecec87ca317d177751
7
- data.tar.gz: a303a1d45f444395ce17ff9d880e5436da0961fccaf1b0edbcbdfc4cbb81da27ce5f9fa4b1d73883c8845dd0ec6cdb53d2e40e6c04571b7989d5b0c0dc6eda51
6
+ metadata.gz: 20a391e64c64aae3fc8cb4a05d490902cc5013b42144e1bb1a91bed8d7f8a1ea6cffc12c7f074a41e765486d356d0cb58401a330c35306bfc36a0403f21d9a30
7
+ data.tar.gz: f65b24ad7f7345f7ec1cf63802479c0eed7385ff7b146dc484f2b3d2ce4702fffc04778f9df8a1b9ef4499e9a46754f350a71fc78ccca0893791fe75d1c4e8c4
@@ -94,9 +94,10 @@ module Decidim
94
94
  end
95
95
 
96
96
  def create_or_update_authorization
97
- handler= @form.verified_handler
98
- handler.user = user
99
- Authorization.create_or_update_from(handler)
97
+ @form.authorization_handlers.each do |handler|
98
+ handler.user = user
99
+ Authorization.create_or_update_from(handler)
100
+ end
100
101
  end
101
102
 
102
103
  def user_authorizations
@@ -7,6 +7,8 @@ module Decidim
7
7
  include ::Decidim::VerifyWoRegistration::ApplicationHelper
8
8
  include FormFactory
9
9
 
10
+ layout "layouts/decidim/authorizations"
11
+
10
12
  before_action :validate_verification_workflow_manifests!
11
13
 
12
14
  helper Decidim::AuthorizationFormHelper
@@ -63,20 +63,15 @@ module Decidim
63
63
  end
64
64
  end
65
65
 
66
- # Provides the handler that verified the user data to the command
67
- def verified_handler
68
- @verified_handler
69
- end
70
-
71
66
  # ----------------------------------------------------------------------
72
67
  private
73
68
  # ----------------------------------------------------------------------
74
69
 
75
- # Check if the data introduced by the user verifies against any handler enabled for the current component.
70
+ # Check if the data introduced by the user verifies against all handlers enabled for the current component.
76
71
  def verify_against_enabled_authorization_handlers
77
- @verified_handler= authorization_handlers.find {|handler| handler.valid? }
72
+ invalid_handler= authorization_handlers.find {|handler| handler.invalid? }
78
73
 
79
- errors.add(:authorizations, :invalid) unless @verified_handler
74
+ errors.add(:authorizations, :invalid) if invalid_handler
80
75
  end
81
76
  end
82
77
  end
@@ -1,50 +1,62 @@
1
- <% if respond_to?(:current_component) && Decidim::VerifyWoRegistration::ApplicationHelper.verify_wo_registration_custom_modal?(current_component) %>
2
- <%= render 'decidim/shared/verify_wo_registration_login_modal' %>
3
- <% else %>
4
- <div class="reveal" id="loginModal" data-reveal>
5
- <div class="reveal__header">
6
- <h3 class="reveal__title"><%= t(".please_sign_in") %></h3>
7
- <button class="close-button" data-close aria-label="Close modal"
8
- type="button">
9
- <span aria-hidden="true">&times;</span>
10
- </button>
11
- </div>
12
- <% if current_organization.sign_in_enabled? %>
13
- <div class="row">
14
- <div class="columns medium-8 medium-centered">
15
- <%= decidim_form_for(Decidim::User.new, as: :user, url: session_path(:user), html: { class: "register-form new_user" }) do |f| %>
16
- <div>
17
- <div class="field">
18
- <%= f.email_field :email, autofocus: true %>
19
- </div>
20
- <div class="field">
21
- <%= f.password_field :password, autocomplete: "off" %>
22
- </div>
23
- </div>
24
- <div class="actions">
25
- <%= f.submit t("devise.sessions.new.sign_in"), class: "button expanded" %>
26
- </div>
1
+ <% verify_wo_registration_enabled = respond_to?(:current_component) && Decidim::VerifyWoRegistration::ApplicationHelper.verify_wo_registration_custom_modal?(current_component) %>
2
+ <%= decidim_modal id: "loginModal", class: "login__modal" do %>
3
+
4
+ <%
5
+ path = if content_for(:redirect_after_login)
6
+ session_path(:user, redirect_url: content_for(:redirect_after_login))
7
+ else
8
+ session_path(:user)
9
+ end
10
+ %>
11
+
12
+ <%= decidim_form_for(Decidim::User.new, namespace: "login", as: :user, url: path, html: { class: nil }) do |f| %>
13
+ <div data-dialog-container>
14
+ <%= icon "login-box-line", class: "w-6 h-6 text-gray fill-current" %>
15
+ <h3 id="dialog-title-loginModal" class="h3"><%= verify_wo_registration_enabled ? t("verify_wo_registration.login_modal.title") : t(".please_log_in") %></h3>
16
+ <div>
17
+ <% if verify_wo_registration_enabled %>
18
+ <h4 class="h4"><%= t("verify_wo_registration.login_modal.col1_title") %></h4>
19
+
20
+ <%= render "decidim/shared/verify_wo_registration_login_modal_col1" %>
21
+
22
+ <h4 class="h4"><%= t("verify_wo_registration.login_modal.col2_title") %></h4>
23
+ <% end %>
24
+
25
+ <% if current_organization.sign_in_enabled? %>
26
+ <% cache current_organization do %>
27
+ <%= render partial: "decidim/devise/shared/omniauth_buttons", locals: { is_horizontal: true } %>
27
28
  <% end %>
28
- <% if current_organization.sign_up_enabled? %>
29
- <p class="text-center">
30
- <%= link_to t(".sign_up"), decidim.new_user_registration_path, class: "sign-up-link" %>
31
- </p>
32
- <% end %>
33
- <p class="text-center">
29
+
30
+ <div class="form__wrapper">
31
+ <%= f.email_field :email, autocomplete: "email", placeholder: t("placeholder_email", scope: "decidim.devise.shared") %>
32
+
33
+ <%= render partial: "decidim/account/password_fields", locals: { form: f } %>
34
+ </div>
35
+
36
+ <div class="login__modal-links">
37
+ <%= link_to t(".sign_up"), decidim.new_user_registration_path, class: "sign-up-link" if current_organization.sign_up_enabled? %>
34
38
  <%= link_to t("devise.shared.links.forgot_your_password"), new_password_path(:user) %>
35
- </p>
39
+ </div>
40
+ <% else %>
41
+ <%= cell("decidim/announcement", t("sign_in_disabled", scope: "decidim.devise.sessions.new"), callout_class: "warning" ) %>
42
+
43
+ <% cache current_organization do %>
44
+ <%= render partial: "decidim/devise/shared/omniauth_buttons", locals: { is_horizontal: true } %>
45
+ <% end %>
46
+ <% end %>
36
47
  </div>
37
48
  </div>
38
- <%= render "decidim/devise/shared/omniauth_buttons_mini" %>
39
- <% else %>
40
- <div class="row">
41
- <div class="columns medium-8 medium-centered">
42
- <p>
43
- <%= t("sign_in_disabled", scope: "decidim.devise.sessions.new") %>
44
- </p>
49
+
50
+ <% if current_organization.sign_in_enabled? %>
51
+ <div data-dialog-actions>
52
+ <button type="button" class="button button__lg button__transparent-secondary" data-dialog-close="loginModal">
53
+ <%= t("cancel", scope: "decidim.admin.actions") %>
54
+ </button>
55
+ <button type="submit" class="button button__lg button__secondary">
56
+ <%= t("devise.sessions.new.log_in") %>
57
+ <%= icon "arrow-right-line", class: "fill-current" %>
58
+ </button>
45
59
  </div>
46
- </div>
47
- <%= render "decidim/devise/shared/omniauth_buttons" %>
60
+ <% end %>
48
61
  <% end %>
49
- </div>
50
62
  <% end %>
@@ -1,10 +1,8 @@
1
- <div class="columns medium-centered">
2
- <div class="text-center">
3
- <%= link_to(t("verify_wo_registration.login_modal.col1_only_verify_btn"),
4
- Decidim::VerifyWoRegistration::Engine.routes.url_helpers.new_verification_path({
5
- component_id: current_component.id,
6
- redirect_url: URI(request.original_fullpath).path,
7
- votable_gid: "gid"
8
- }), class: "button expanded") %>
9
- </div>
1
+ <div class="form__wrapper">
2
+ <%= link_to(t("verify_wo_registration.login_modal.col1_only_verify_btn"),
3
+ Decidim::VerifyWoRegistration::Engine.routes.url_helpers.new_verification_path({
4
+ component_id: current_component.id,
5
+ redirect_url: URI(request.original_fullpath).path,
6
+ votable_gid: "gid"
7
+ }), class: "button button__lg button__secondary") %>
10
8
  </div>
@@ -1,15 +1,10 @@
1
1
  <% form.object.authorization_handlers.each_with_index do |handler, handler_idx| %>
2
- <div class="card-section">
3
- <div class="card__header collapse">
4
- <h5 class="card__title">
5
- <%= t("authorize_with", authorizer: t("#{handler.handler_name}.name", scope: "decidim.authorization_handlers"), scope: "decidim.verifications.authorizations.new") %>
6
- </h5>
2
+ <h2 class="h3">
3
+ <%= t("authorize_with", authorizer: t("#{handler.handler_name}.name", scope: "decidim.authorization_handlers"), scope: "decidim.verifications.authorizations.new") %>
4
+ </h2>
5
+ <%= form.fields_for "authorizations[#{handler_idx}]", handler, builder: Decidim::AuthorizationFormBuilder do |handler_form| %>
6
+ <div id="authorization-handler-<%= handler_form.object.handler_name %>" class="authorization-handler form__wrapper">
7
+ <%= render "handler_form", handler_form: handler_form %>
7
8
  </div>
8
-
9
- <%= form.fields_for "authorizations[#{handler_idx}]", handler, builder: Decidim::AuthorizationFormBuilder do |handler_form| %>
10
- <div id="authorization-handler-<%= handler_form.object.handler_name %>" class="authorization-handler">
11
- <%= render "handler_form", handler_form: handler_form %>
12
- </div>
13
- <% end %>
14
- </div>
9
+ <% end %>
15
10
  <% end %>
@@ -1,27 +1,19 @@
1
- <div class="wrapper">
2
- <div class="row">
3
- <div class="columns large-6 medium-centered">
4
- <h2 class="heading2"><%= t("verify_wo_registration.form.title") %></h2>
5
- <p><%= t("verify_wo_registration.form.description") %></p>
6
- <%= cell("decidim/announcement", { announcement: t("verify_wo_registration.form.announcement", minutes: ::Decidim::ImpersonationLog::SESSION_TIME_IN_MINUTES), callout_class: "warning" }) %>
7
- </div>
8
- </div>
9
-
10
- <div class="row">
11
- <div class="columns large-6 medium-centered">
12
- <%= decidim_form_for(@form, url: verifications_path, html: { class: "form" }) do |form| %>
13
- <div class="card">
14
- <div class="card__content">
15
- <%= render partial: "form", object: form %>
16
- <%= form.hidden_field :component_id %>
17
- <%= form.hidden_field :redirect_url %>
18
- </div>
19
- </div>
1
+ <div class="text-center py-10">
2
+ <h1 class="title-decorator inline-block text-left">
3
+ <%= t("verify_wo_registration.form.title") %>
4
+ </h1>
5
+ </div>
6
+ <p><%= t("verify_wo_registration.form.description") %></p>
7
+ <%= cell("decidim/announcement", { announcement: t("verify_wo_registration.form.announcement", minutes: ::Decidim::ImpersonationLog::SESSION_TIME_IN_MINUTES), callout_class: "warning" }) %>
20
8
 
21
- <div class="button--double form-general-submit">
22
- <%= form.submit(t("verify_wo_registration.form.submit_btn")) %>
23
- </div>
24
- <% end %>
9
+ <%= decidim_form_for(@form, url: verifications_path) do |form| %>
10
+ <%= render partial: "form", object: form %>
11
+ <%= form.hidden_field :component_id %>
12
+ <%= form.hidden_field :redirect_url %>
13
+ <div class="form__wrapper-block flex-col-reverse md:flex-row justify-between">
14
+ <button type="submit" class="button button__sm md:button__lg button__secondary">
15
+ <%= t("verify_wo_registration.form.submit_btn") %>
16
+ <%= icon "arrow-right-line", class: "fill-current" %>
17
+ </button>
25
18
  </div>
26
- </div>
27
- </div>
19
+ <% end %>
@@ -3,8 +3,8 @@
3
3
  module Decidim
4
4
  # This holds the decidim-meetings version.
5
5
  module VerifyWoRegistration
6
- VERSION = '0.1.0'
7
- DECIDIM_VER = '>= 0.27'
6
+ VERSION = '0.3.0'
7
+ DECIDIM_VER = '>= 0.28'
8
8
 
9
9
  def self.version
10
10
  VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-verify_wo_registration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Valls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-20 00:00:00.000000000 Z
11
+ date: 2024-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-budgets
@@ -16,84 +16,84 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.27'
19
+ version: '0.28'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.27'
26
+ version: '0.28'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: decidim-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.27'
33
+ version: '0.28'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.27'
40
+ version: '0.28'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: decidim-proposals
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.27'
47
+ version: '0.28'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.27'
54
+ version: '0.28'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: decidim
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.27'
61
+ version: '0.28'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0.27'
68
+ version: '0.28'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: decidim-dev
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0.27'
75
+ version: '0.28'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0.27'
82
+ version: '0.28'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: decidim-participatory_processes
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0.27'
89
+ version: '0.28'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0.27'
96
+ version: '0.28'
97
97
  description: Adds the hability for proposals and budgets components to allow users
98
98
  to give support without being registered. Enabling this feature the user is requested
99
99
  for verification and then, on success, logged in in a 30min session..
@@ -115,9 +115,7 @@ files:
115
115
  - app/models/decidim/verify_wo_registration/application_record.rb
116
116
  - app/packs/images/decidim/verify_wo_registration/icon.svg
117
117
  - app/views/decidim/shared/_login_modal.html.erb
118
- - app/views/decidim/shared/_verify_wo_registration_login_modal.html.erb
119
118
  - app/views/decidim/shared/_verify_wo_registration_login_modal_col1.html.erb
120
- - app/views/decidim/shared/_verify_wo_registration_login_modal_col2.html.erb
121
119
  - app/views/decidim/verify_wo_registration/verifications/_form.html.erb
122
120
  - app/views/decidim/verify_wo_registration/verifications/_handler_form.html.erb
123
121
  - app/views/decidim/verify_wo_registration/verifications/new.html.erb
@@ -152,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
150
  - !ruby/object:Gem::Version
153
151
  version: '0'
154
152
  requirements: []
155
- rubygems_version: 3.2.22
153
+ rubygems_version: 3.3.7
156
154
  signing_key:
157
155
  specification_version: 4
158
156
  summary: Adds the hability for proposals and budgets components to allow users to
@@ -1,23 +0,0 @@
1
- <div class="reveal two_columns" id="loginModal" data-reveal>
2
- <div class="reveal__header">
3
- <h3 class="reveal__title"><%= t("verify_wo_registration.login_modal.title") %></h3>
4
- <button class="close-button" data-close aria-label="Close modal"
5
- type="button">
6
- <span aria-hidden="true">&times;</span>
7
- </button>
8
- </div>
9
- <div class="row">
10
- <div class="columns medium-6">
11
- <div class="columns medium-centered">
12
- <h5><%= t("verify_wo_registration.login_modal.col1_title") %></h5>
13
- <%= render "decidim/shared/verify_wo_registration_login_modal_col1" %>
14
- </div>
15
- </div>
16
- <div class="columns medium-6">
17
- <div class="columns medium-centered">
18
- <h5><%= t("verify_wo_registration.login_modal.col2_title") %></h5>
19
- <%= render "decidim/shared/verify_wo_registration_login_modal_col2" %>
20
- </div>
21
- </div>
22
- </div>
23
- </div>
@@ -1,31 +0,0 @@
1
- <% if current_organization.sign_in_enabled? %>
2
- <%= decidim_form_for(Decidim::User.new, as: :user, url: session_path(:user), html: { class: "register-form new_user" }) do |f| %>
3
- <div>
4
- <div class="field">
5
- <%= f.email_field :email, autofocus: true %>
6
- </div>
7
- <div class="field">
8
- <%= f.password_field :password, autocomplete: "off" %>
9
- </div>
10
- </div>
11
- <div class="actions">
12
- <%= f.submit t("devise.sessions.new.sign_in"), class: "button expanded" %>
13
- </div>
14
- <% end %>
15
- <% if current_organization.sign_up_enabled? %>
16
- <p class="text-center">
17
- <%= link_to t("decidim.shared.login_modal.sign_up"), decidim.new_user_registration_path, class: "sign-up-link" %>
18
- </p>
19
- <% end %>
20
- <p class="text-center">
21
- <%= link_to t("devise.shared.links.forgot_your_password"), new_password_path(:user) %>
22
- </p>
23
- <div style="box-sizing: unset">
24
- <%= render "decidim/devise/shared/omniauth_buttons_mini" %>
25
- </div>
26
- <% else %>
27
- <p style="box-sizing: unset">
28
- <%= t("sign_in_disabled", scope: "decidim.devise.sessions.new") %>
29
- </p>
30
- <%= render "decidim/devise/shared/omniauth_buttons" %>
31
- <% end %>