decidim-system 0.27.9 → 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -7
- data/app/commands/decidim/system/create_admin.rb +1 -1
- data/app/commands/decidim/system/create_default_content_blocks.rb +1 -14
- data/app/commands/decidim/system/create_default_pages.rb +23 -4
- data/app/commands/decidim/system/populate_help.rb +2 -2
- data/app/commands/decidim/system/register_organization.rb +18 -8
- data/app/commands/decidim/system/update_admin.rb +1 -1
- data/app/commands/decidim/system/update_organization.rb +2 -1
- data/app/controllers/decidim/system/application_controller.rb +1 -1
- data/app/controllers/decidim/system/dashboard_controller.rb +1 -0
- data/app/controllers/decidim/system/organizations_controller.rb +30 -9
- data/app/forms/decidim/system/admin_form.rb +1 -1
- data/app/forms/decidim/system/update_organization_form.rb +16 -17
- data/app/jobs/decidim/system/application_job.rb +1 -1
- data/app/mailers/decidim/system/application_mailer.rb +12 -0
- data/app/packs/entrypoints/decidim_system.js +5 -3
- data/app/packs/stylesheets/decidim/system/application.scss +108 -21
- data/app/views/decidim/system/admins/_form.html.erb +1 -7
- data/app/views/decidim/system/admins/edit.html.erb +3 -3
- data/app/views/decidim/system/admins/index.html.erb +3 -31
- data/app/views/decidim/system/admins/new.html.erb +3 -3
- data/app/views/decidim/system/dashboard/show.html.erb +13 -3
- data/app/views/decidim/system/devise/mailers/password_change.html.erb +1 -1
- data/app/views/decidim/system/devise/mailers/reset_password_instructions.html.erb +2 -2
- data/app/views/decidim/system/devise/passwords/edit.html.erb +5 -8
- data/app/views/decidim/system/devise/passwords/new.html.erb +5 -5
- data/app/views/decidim/system/devise/sessions/new.html.erb +10 -12
- data/app/views/decidim/system/oauth_applications/_form.html.erb +5 -20
- data/app/views/decidim/system/oauth_applications/edit.html.erb +9 -11
- data/app/views/decidim/system/oauth_applications/index.html.erb +6 -8
- data/app/views/decidim/system/oauth_applications/new.html.erb +9 -11
- data/app/views/decidim/system/oauth_applications/show.html.erb +20 -23
- data/app/views/decidim/system/organizations/_advanced_settings.html.erb +10 -8
- data/app/views/decidim/system/organizations/_csp_settings.html.erb +12 -0
- data/app/views/decidim/system/organizations/_file_upload_settings.erb +23 -46
- data/app/views/decidim/system/organizations/_omniauth_provider.html.erb +13 -16
- data/app/views/decidim/system/organizations/_omniauth_settings.html.erb +6 -8
- data/app/views/decidim/system/organizations/_smtp_settings.html.erb +12 -22
- data/app/views/decidim/system/organizations/edit.html.erb +29 -26
- data/app/views/decidim/system/organizations/index.html.erb +3 -4
- data/app/views/decidim/system/organizations/new.html.erb +29 -42
- data/app/views/decidim/system/shared/_admins_list.html.erb +27 -0
- data/app/views/decidim/system/shared/_notices.html.erb +4 -6
- data/app/views/decidim/system/shared/_organizations_list.html.erb +10 -3
- data/app/views/layouts/decidim/system/_header.html.erb +2 -2
- data/app/views/layouts/decidim/system/_login_items.html.erb +3 -7
- data/app/views/layouts/decidim/system/_sidebar.html.erb +3 -7
- data/app/views/layouts/decidim/system/application.html.erb +24 -28
- data/app/views/layouts/decidim/system/login.html.erb +10 -9
- data/config/locales/ar.yml +0 -12
- data/config/locales/bg.yml +0 -214
- data/config/locales/ca.yml +69 -18
- data/config/locales/cs.yml +69 -12
- data/config/locales/de.yml +62 -18
- data/config/locales/el.yml +8 -11
- data/config/locales/en.yml +70 -18
- data/config/locales/eo.yml +0 -7
- data/config/locales/es-MX.yml +70 -18
- data/config/locales/es-PY.yml +70 -18
- data/config/locales/es.yml +70 -18
- data/config/locales/eu.yml +69 -17
- data/config/locales/fa-IR.yml +0 -5
- data/config/locales/fi-plain.yml +69 -18
- data/config/locales/fi.yml +71 -20
- data/config/locales/fr-CA.yml +44 -24
- data/config/locales/fr.yml +54 -18
- data/config/locales/ga-IE.yml +0 -4
- data/config/locales/gl.yml +0 -12
- data/config/locales/hu.yml +0 -35
- data/config/locales/id-ID.yml +0 -10
- data/config/locales/is-IS.yml +0 -10
- data/config/locales/it.yml +0 -13
- data/config/locales/ja.yml +43 -24
- data/config/locales/lb.yml +0 -5
- data/config/locales/lt.yml +18 -11
- data/config/locales/lv.yml +0 -27
- data/config/locales/nl.yml +0 -20
- data/config/locales/no.yml +0 -12
- data/config/locales/pl.yml +0 -53
- data/config/locales/pt-BR.yml +0 -38
- data/config/locales/pt.yml +0 -12
- data/config/locales/ro-RO.yml +3 -19
- data/config/locales/ru.yml +0 -27
- data/config/locales/sk.yml +0 -27
- data/config/locales/sl.yml +0 -26
- data/config/locales/sr-CS.yml +0 -17
- data/config/locales/sv.yml +0 -12
- data/config/locales/tr-TR.yml +3 -15
- data/config/locales/uk.yml +0 -21
- data/config/locales/zh-CN.yml +0 -12
- data/config/locales/zh-TW.yml +7 -10
- data/config/routes.rb +6 -2
- data/db/seeds.rb +1 -1
- data/lib/decidim/system/engine.rb +2 -25
- data/lib/decidim/system/menu.rb +35 -0
- data/lib/decidim/system/version.rb +1 -1
- data/lib/tasks/decidim_system.rake +1 -1
- metadata +22 -28
- data/app/packs/entrypoints/decidim_system.scss +0 -1
- data/app/packs/images/decidim/system/.keep +0 -0
- data/app/packs/src/decidim/system/application.js +0 -41
- data/app/packs/stylesheets/decidim/system/_actions.scss +0 -8
- data/app/packs/stylesheets/decidim/system/_forms.scss +0 -36
- data/app/packs/stylesheets/decidim/system/_foundation_and_overrides.scss +0 -53
- data/app/packs/stylesheets/decidim/system/_layout.scss +0 -18
- data/app/packs/stylesheets/decidim/system/_login.scss +0 -37
- data/app/packs/stylesheets/decidim/system/_settings.scss +0 -569
- data/app/packs/stylesheets/decidim/system/_sidebar.scss +0 -83
- data/app/packs/stylesheets/decidim/system/_tables.scss +0 -6
- data/app/views/decidim/system/admins/show.html.erb +0 -9
- data/app/views/decidim/system/organizations/show.html.erb +0 -10
- data/config/locales/he-IL.yml +0 -1
- data/decidim-system.gemspec +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70370fff5369d1099a226723a77145a27c19ee6ff1e214ff4bb6d8fc445934bd
|
4
|
+
data.tar.gz: 9d38c13b4de6dc0348aeeb2d38038e73241aebf162f967aa2d706e57f20f856c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c81b3698abfbfda68d44bd5c5c33609358ce58d63d2b7bbbad7fa7eca463ac72b3a9bf36d58316f1bc9a11083e6a48c25fe7450518425b6106fc4b1eb03eac6e
|
7
|
+
data.tar.gz: 55060e2ef6cd99807b4c9e61ea110e7cbdc43724ef1963a54c1011fbfcabd7f41140c9db0d523d78a25ead5d3ce7b053663d36bc70f90ed0b268ca7ac2010aec
|
data/README.md
CHANGED
@@ -27,9 +27,9 @@ When using Decidim as multi-tenant, you should keep these in mind:
|
|
27
27
|
|
28
28
|
* All organizations share the same database.
|
29
29
|
* Each organization must have a different hostname.
|
30
|
-
* Users
|
30
|
+
* Users are not shared between each organization (the same email can be registered in different organizations and it will be considered as different users).
|
31
31
|
* All configuration related to Decidim (`Decidim.config`) is shared between the organizations.
|
32
|
-
* Stylesheets
|
32
|
+
* Stylesheets are not customizable per-tenant so UI styles (colors and other variables) are shared.
|
33
33
|
|
34
34
|
## Glossary
|
35
35
|
|
@@ -40,26 +40,29 @@ When using Decidim as multi-tenant, you should keep these in mind:
|
|
40
40
|
|
41
41
|
## Managing System admins
|
42
42
|
|
43
|
-
For logging in to this dashboard, you
|
43
|
+
For logging in to this dashboard, you will need to create a system admin account from your terminal:
|
44
44
|
|
45
45
|
```bash
|
46
46
|
bin/rails decidim_system:create_admin
|
47
47
|
```
|
48
48
|
|
49
|
-
You
|
49
|
+
You will be asked for an email and a password. For security, the password will not get displayed back at you and you will need to confirm it.
|
50
50
|
|
51
51
|
Once you have created your first admin you can access the system dashboard at `/system`. For instance, if you have Decidim running at `https://example.org`, this URL would be `https://example.org/system`.
|
52
|
-
You
|
52
|
+
You will be able to login with your newly created user.
|
53
53
|
|
54
54
|
From the system dashboard you can add new admins.
|
55
55
|
|
56
|
-
⚠️ If you need to reset your administrator password you
|
56
|
+
⚠️ If you need to reset your administrator password you will need to do it by entering the Rails console and changing it manually. ⚠️
|
57
57
|
|
58
58
|
. Open the rails console:
|
59
|
+
|
59
60
|
```bash
|
60
61
|
bin/rails console
|
61
62
|
```
|
63
|
+
|
62
64
|
. Run the following instructions, changing them accordingly:
|
65
|
+
|
63
66
|
```ruby
|
64
67
|
system_admin = Decidim::System::Admin.order(:id).first # for the first system admin
|
65
68
|
system_admin = Decidim::System::Admin.find_by_email "system@example.org" # if you already know the email
|
@@ -73,7 +76,7 @@ system_admin.save
|
|
73
76
|
Once you have your system admin setup you can also start managing the organizations in your deploy. To do it, login at the system dashboard and create a new organization
|
74
77
|
following the form instructions. After creating it, a new admin user will be created and invited to start managing it.
|
75
78
|
|
76
|
-
Remember that System admins and regular Admins are completely different users (they
|
79
|
+
Remember that System admins and regular Admins are completely different users (they do not even share the same database table), so you cannot use your
|
77
80
|
system user to login in as an organization admin.
|
78
81
|
|
79
82
|
## Contributing
|
@@ -15,7 +15,7 @@ module Decidim
|
|
15
15
|
# Executes the command. Broadcasts these events:
|
16
16
|
#
|
17
17
|
# - :ok when everything is valid.
|
18
|
-
# - :invalid if the form
|
18
|
+
# - :invalid if the form was not valid and we could not proceed.
|
19
19
|
#
|
20
20
|
# Returns nothing.
|
21
21
|
def call
|
@@ -19,24 +19,11 @@ module Decidim
|
|
19
19
|
#
|
20
20
|
# Returns nothing.
|
21
21
|
def call
|
22
|
-
|
23
|
-
weight = (index + 1) * 10
|
24
|
-
Decidim::ContentBlock.create(
|
25
|
-
decidim_organization_id: organization.id,
|
26
|
-
weight: weight,
|
27
|
-
scope_name: :homepage,
|
28
|
-
manifest_name: manifest.name,
|
29
|
-
published_at: Time.current
|
30
|
-
)
|
31
|
-
end
|
22
|
+
Decidim::ContentBlocksCreator.new(organization).create_default!
|
32
23
|
end
|
33
24
|
|
34
25
|
private
|
35
26
|
|
36
|
-
def content_blocks
|
37
|
-
Decidim.content_blocks.for(:homepage).select(&:default)
|
38
|
-
end
|
39
|
-
|
40
27
|
attr_reader :organization
|
41
28
|
end
|
42
29
|
end
|
@@ -14,16 +14,20 @@ module Decidim
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# Executes the command.
|
17
|
+
# i18n-tasks-use t('decidim.system.default_pages.terms-of-service')
|
17
18
|
#
|
18
19
|
# Returns nothing.
|
19
20
|
def call
|
20
21
|
Decidim::StaticPage::DEFAULT_PAGES.map do |slug|
|
21
|
-
Decidim::StaticPage.find_or_create_by!(organization
|
22
|
-
|
23
|
-
page.
|
22
|
+
static_page = Decidim::StaticPage.find_or_create_by!(organization:, slug:) do |page|
|
23
|
+
translated_slug = I18n.t(slug, scope: "decidim.system.default_pages")
|
24
|
+
page.title = localized_attribute(translated_slug, :title)
|
25
|
+
page.content = localized_attribute(translated_slug, :content)
|
24
26
|
page.show_in_footer = true
|
25
|
-
page.allow_public_access = true if slug == "terms-
|
27
|
+
page.allow_public_access = true if slug == "terms-of-service"
|
26
28
|
end
|
29
|
+
|
30
|
+
create_summary_content_blocks_for(static_page) if slug == "terms-of-service"
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
@@ -40,6 +44,21 @@ module Decidim
|
|
40
44
|
result.update(locale => text)
|
41
45
|
end
|
42
46
|
end
|
47
|
+
|
48
|
+
def create_summary_content_blocks_for(page)
|
49
|
+
content_block_summary = Decidim::ContentBlock.create(
|
50
|
+
organization:,
|
51
|
+
scope_name: :static_page,
|
52
|
+
manifest_name: :summary,
|
53
|
+
weight: 1,
|
54
|
+
scoped_resource_id: page.id,
|
55
|
+
published_at: Time.current
|
56
|
+
)
|
57
|
+
|
58
|
+
translated_slug = I18n.t(page.slug, scope: "decidim.system.default_pages")
|
59
|
+
content_block_summary.settings = { summary: localized_attribute(translated_slug, :summary) }
|
60
|
+
content_block_summary.save!
|
61
|
+
end
|
43
62
|
end
|
44
63
|
end
|
45
64
|
end
|
@@ -27,7 +27,7 @@ module Decidim
|
|
27
27
|
slug: "help",
|
28
28
|
title: multi_translation("decidim.help.main_topic.default_page.title", organization: @organization.name),
|
29
29
|
content: multi_translation("decidim.help.main_topic.default_page.content", organization: @organization.name),
|
30
|
-
topic
|
30
|
+
topic:,
|
31
31
|
organization: @organization,
|
32
32
|
weight: 0
|
33
33
|
)
|
@@ -40,7 +40,7 @@ module Decidim
|
|
40
40
|
title: multi_translation("#{scope}.title"),
|
41
41
|
content: multi_translation("#{scope}.page"),
|
42
42
|
slug: manifest.name,
|
43
|
-
topic
|
43
|
+
topic:,
|
44
44
|
organization: @organization
|
45
45
|
)
|
46
46
|
|
@@ -2,9 +2,6 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module System
|
5
|
-
class InvitationFailedError < ActiveRecord::RecordInvalid
|
6
|
-
end
|
7
|
-
|
8
5
|
# A command with all the business logic when creating a new organization in
|
9
6
|
# the system. It creates the organization and invites the admin to the
|
10
7
|
# system.
|
@@ -19,7 +16,7 @@ module Decidim
|
|
19
16
|
# Executes the command. Broadcasts these events:
|
20
17
|
#
|
21
18
|
# - :ok when everything is valid.
|
22
|
-
# - :invalid if the form
|
19
|
+
# - :invalid if the form was not valid and we could not proceed.
|
23
20
|
#
|
24
21
|
# Returns nothing.
|
25
22
|
def call
|
@@ -27,6 +24,7 @@ module Decidim
|
|
27
24
|
|
28
25
|
@organization = nil
|
29
26
|
invite_form = nil
|
27
|
+
invitation_failed = false
|
30
28
|
|
31
29
|
transaction do
|
32
30
|
@organization = create_organization
|
@@ -34,14 +32,13 @@ module Decidim
|
|
34
32
|
PopulateHelp.call(@organization)
|
35
33
|
CreateDefaultContentBlocks.call(@organization)
|
36
34
|
invite_form = invite_user_form(@organization)
|
37
|
-
|
35
|
+
invitation_failed = invite_form.invalid?
|
38
36
|
end
|
37
|
+
return broadcast(:invalid) if invitation_failed
|
39
38
|
|
40
39
|
Decidim::InviteUser.call(invite_form) if @organization && invite_form
|
41
40
|
|
42
41
|
broadcast(:ok)
|
43
|
-
rescue InvitationFailedError
|
44
|
-
broadcast(:invalid_invitation)
|
45
42
|
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique
|
46
43
|
broadcast(:invalid)
|
47
44
|
end
|
@@ -67,10 +64,23 @@ module Decidim
|
|
67
64
|
omniauth_settings: form.encrypted_omniauth_settings,
|
68
65
|
smtp_settings: form.encrypted_smtp_settings,
|
69
66
|
send_welcome_notification: true,
|
70
|
-
file_upload_settings: form.file_upload_settings.final
|
67
|
+
file_upload_settings: form.file_upload_settings.final,
|
68
|
+
colors: default_colors,
|
69
|
+
content_security_policy: form.content_security_policy
|
71
70
|
)
|
72
71
|
end
|
73
72
|
|
73
|
+
def default_colors
|
74
|
+
{
|
75
|
+
alert: "#ec5840",
|
76
|
+
primary: "#53bf40",
|
77
|
+
success: "#57d685",
|
78
|
+
warning: "#ffae00",
|
79
|
+
tertiary: "#bf4053",
|
80
|
+
secondary: "#4053bf"
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
74
84
|
def invite_user_form(organization)
|
75
85
|
Decidim::InviteUserForm.from_params(
|
76
86
|
name: form.organization_admin_name,
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
# Executes the command. Broadcasts these events:
|
17
17
|
#
|
18
18
|
# - :ok when everything is valid.
|
19
|
-
# - :invalid if the form
|
19
|
+
# - :invalid if the form was not valid and we could not proceed.
|
20
20
|
#
|
21
21
|
# Returns nothing.
|
22
22
|
def call
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
# Executes the command. Broadcasts these events:
|
18
18
|
#
|
19
19
|
# - :ok when everything is valid.
|
20
|
-
# - :invalid if the form
|
20
|
+
# - :invalid if the form was not valid and we could not proceed.
|
21
21
|
#
|
22
22
|
# Returns nothing.
|
23
23
|
def call
|
@@ -53,6 +53,7 @@ module Decidim
|
|
53
53
|
organization.omniauth_settings = form.encrypted_omniauth_settings
|
54
54
|
organization.smtp_settings = form.encrypted_smtp_settings
|
55
55
|
organization.file_upload_settings = form.file_upload_settings.final
|
56
|
+
organization.content_security_policy = form.content_security_policy
|
56
57
|
|
57
58
|
organization.save!
|
58
59
|
end
|
@@ -6,7 +6,7 @@ module Decidim
|
|
6
6
|
class ApplicationController < ActionController::Base
|
7
7
|
include FormFactory
|
8
8
|
include PayloadInfo
|
9
|
-
include HttpCachingDisabler
|
9
|
+
include Headers::HttpCachingDisabler
|
10
10
|
include DisableRedirectionToExternalHost
|
11
11
|
|
12
12
|
protect_from_forgery with: :exception, prepend: true
|
@@ -9,7 +9,7 @@ module Decidim
|
|
9
9
|
helper Decidim::OmniauthHelper
|
10
10
|
|
11
11
|
def new
|
12
|
-
@form = form(RegisterOrganizationForm).
|
12
|
+
@form = form(RegisterOrganizationForm).from_params(default_params)
|
13
13
|
@form.file_upload_settings = form(FileUploadSettingsForm).from_model({})
|
14
14
|
end
|
15
15
|
|
@@ -18,15 +18,10 @@ module Decidim
|
|
18
18
|
|
19
19
|
RegisterOrganization.call(@form) do
|
20
20
|
on(:ok) do
|
21
|
-
flash[:notice] = t("organizations.create.
|
21
|
+
flash[:notice] = t("organizations.create.success_html", scope: "decidim.system", host: @form.host, email: @form.organization_admin_email)
|
22
22
|
redirect_to organizations_path
|
23
23
|
end
|
24
24
|
|
25
|
-
on(:invalid_invitation) do
|
26
|
-
flash.now[:alert] = t("organizations.create.error_invitation", scope: "decidim.system")
|
27
|
-
render :new
|
28
|
-
end
|
29
|
-
|
30
25
|
on(:invalid) do
|
31
26
|
flash.now[:alert] = t("organizations.create.error", scope: "decidim.system")
|
32
27
|
render :new
|
@@ -43,8 +38,8 @@ module Decidim
|
|
43
38
|
end
|
44
39
|
|
45
40
|
def edit
|
46
|
-
organization = Organization.find(params[:id])
|
47
|
-
@form = form(UpdateOrganizationForm).from_model(organization)
|
41
|
+
@organization = Organization.find(params[:id])
|
42
|
+
@form = form(UpdateOrganizationForm).from_model(@organization)
|
48
43
|
end
|
49
44
|
|
50
45
|
def update
|
@@ -63,8 +58,34 @@ module Decidim
|
|
63
58
|
end
|
64
59
|
end
|
65
60
|
|
61
|
+
def resend_invitation
|
62
|
+
organization = Organization.find(params[:id])
|
63
|
+
InviteUserAgain.call(organization.users.first, "invite_admin") do
|
64
|
+
on(:ok) do
|
65
|
+
flash[:notice] = t("organizations.resend_invitation.success", scope: "decidim.system")
|
66
|
+
end
|
67
|
+
|
68
|
+
on(:invalid) do
|
69
|
+
flash[:alert] = I18n.t("organizations.resend_invitation.error", scope: "decidim.system")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
redirect_to organizations_path
|
74
|
+
end
|
75
|
+
|
66
76
|
private
|
67
77
|
|
78
|
+
def default_params
|
79
|
+
{
|
80
|
+
host: request.host,
|
81
|
+
organization_admin_name: current_admin.email.split("@")[0],
|
82
|
+
organization_admin_email: current_admin.email,
|
83
|
+
available_locales: Decidim.available_locales.map(&:to_s),
|
84
|
+
default_locale: Decidim.default_locale,
|
85
|
+
users_registration_mode: "enabled"
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
68
89
|
# The current organization for the request.
|
69
90
|
#
|
70
91
|
# Returns an Organization.
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def email_uniqueness
|
25
|
-
return unless Admin.where(email:
|
25
|
+
return unless Admin.where(email:).where.not(id:).any?
|
26
26
|
|
27
27
|
errors.add(:email, I18n.t("models.admin.validations.email_uniqueness",
|
28
28
|
scope: "decidim.system"))
|
@@ -29,6 +29,18 @@ module Decidim
|
|
29
29
|
[:authentication, String],
|
30
30
|
[:enable_starttls_auto, Boolean]
|
31
31
|
]
|
32
|
+
|
33
|
+
jsonb_attribute :content_security_policy, [
|
34
|
+
[:"default-src", String],
|
35
|
+
[:"img-src", String],
|
36
|
+
[:"media-src", String],
|
37
|
+
[:"script-src", String],
|
38
|
+
[:"style-src", String],
|
39
|
+
[:"frame-src", String],
|
40
|
+
[:"font-src", String],
|
41
|
+
[:"connect-src", String]
|
42
|
+
]
|
43
|
+
|
32
44
|
attribute :password, String
|
33
45
|
attribute :file_upload_settings, FileUploadSettingsForm
|
34
46
|
|
@@ -46,7 +58,6 @@ module Decidim
|
|
46
58
|
|
47
59
|
validates :name, :host, :users_registration_mode, presence: true
|
48
60
|
validate :validate_organization_uniqueness
|
49
|
-
validate :validate_secret_key_base_for_encryption
|
50
61
|
validates :users_registration_mode, inclusion: { in: Decidim::Organization.users_registration_modes }
|
51
62
|
|
52
63
|
def map_model(model)
|
@@ -76,9 +87,7 @@ module Decidim
|
|
76
87
|
def encrypted_smtp_settings
|
77
88
|
smtp_settings["from"] = set_from
|
78
89
|
|
79
|
-
|
80
|
-
# if all are empty, nil is returned so it does not break ENV vars configuration
|
81
|
-
encrypted.values.all?(&:blank?) ? nil : encrypted
|
90
|
+
smtp_settings.merge(encrypted_password: Decidim::AttributeEncryptor.encrypt(password))
|
82
91
|
end
|
83
92
|
|
84
93
|
def set_from
|
@@ -88,26 +97,16 @@ module Decidim
|
|
88
97
|
end
|
89
98
|
|
90
99
|
def encrypted_omniauth_settings
|
91
|
-
|
100
|
+
omniauth_settings.transform_values do |v|
|
92
101
|
Decidim::OmniauthProvider.value_defined?(v) ? Decidim::AttributeEncryptor.encrypt(v) : v
|
93
102
|
end
|
94
|
-
# if all are empty, nil is returned so it does not break ENV vars configuration
|
95
|
-
encrypted.values.all?(&:blank?) ? nil : encrypted
|
96
103
|
end
|
97
104
|
|
98
105
|
private
|
99
106
|
|
100
107
|
def validate_organization_uniqueness
|
101
|
-
errors.add(:name, :taken) if Decidim::Organization.where(name:
|
102
|
-
errors.add(:host, :taken) if Decidim::Organization.where(host:
|
103
|
-
end
|
104
|
-
|
105
|
-
# We need a valid secret key base for encrypting the SMTP password with it
|
106
|
-
# It is also necessary for other things in Rails (like Cookies encryption)
|
107
|
-
def validate_secret_key_base_for_encryption
|
108
|
-
return if Rails.application.secrets.secret_key_base&.length == 128
|
109
|
-
|
110
|
-
errors.add(:password, I18n.t("activemodel.errors.models.organization.attributes.password.secret_key"))
|
108
|
+
errors.add(:name, :taken) if Decidim::Organization.where(name:).where.not(id:).exists?
|
109
|
+
errors.add(:host, :taken) if Decidim::Organization.where(host:).where.not(id:).exists?
|
111
110
|
end
|
112
111
|
end
|
113
112
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module System
|
5
|
+
# Custom application mailer, scoped to the system mailer.
|
6
|
+
#
|
7
|
+
class ApplicationMailer < ActionMailer::Base
|
8
|
+
default from: Decidim.config.mailer_sender
|
9
|
+
layout "mailer"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -1,22 +1,109 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
@import "tom-select/dist/scss/tom-select";
|
2
|
+
|
3
|
+
:root {
|
4
|
+
--primary: #e02d2d;
|
5
|
+
--primary-rgb: 224 45 45;
|
6
|
+
--secondary: #155abf;
|
7
|
+
--secondary-rgb: 21 90 191;
|
8
|
+
--tertiary: #ebc34b;
|
9
|
+
--tertiary-rgb: 235 195 75;
|
10
|
+
--success: #28a745;
|
11
|
+
--success-rgb: 40 167 69;
|
12
|
+
--warning: #ffb703;
|
13
|
+
--warning-rgb: 255 183 3;
|
14
|
+
--alert: #e7131a;
|
15
|
+
--alert-rgb: 231 19 26;
|
16
|
+
}
|
17
|
+
|
18
|
+
aside {
|
19
|
+
@apply bg-gray-4 w-full md:w-1/6 min-w-[250px] flex-none text-white relative translate-x-0 transition;
|
20
|
+
|
21
|
+
&[aria-hidden="true"] {
|
22
|
+
@apply absolute -translate-x-full;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
.main-nav {
|
27
|
+
li {
|
28
|
+
@apply border-l-2 border-transparent font-semibold hover:bg-black transition;
|
29
|
+
|
30
|
+
&.active {
|
31
|
+
@apply border-primary bg-black;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
a {
|
36
|
+
@apply block p-4;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
table {
|
41
|
+
@apply w-full border-collapse;
|
42
|
+
|
43
|
+
th {
|
44
|
+
@apply font-semibold bg-background;
|
45
|
+
}
|
46
|
+
|
47
|
+
td,
|
48
|
+
th {
|
49
|
+
@apply p-2 text-center first:text-left;
|
50
|
+
}
|
51
|
+
|
52
|
+
tr:nth-child(even) td {
|
53
|
+
@apply bg-gray-3;
|
54
|
+
}
|
55
|
+
|
56
|
+
a {
|
57
|
+
@apply text-primary underline;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
[id^="advanced-settings"] {
|
62
|
+
&[aria-expanded="false"] span:first-child,
|
63
|
+
&[aria-expanded="true"] span:last-child {
|
64
|
+
@apply block;
|
65
|
+
}
|
66
|
+
|
67
|
+
&[aria-expanded="false"] span:last-child,
|
68
|
+
&[aria-expanded="true"] span:first-child {
|
69
|
+
@apply hidden;
|
70
|
+
}
|
71
|
+
|
72
|
+
&[aria-hidden="true"] {
|
73
|
+
@apply hidden;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
dl {
|
78
|
+
dt {
|
79
|
+
@apply font-semibold;
|
80
|
+
}
|
81
|
+
|
82
|
+
dd {
|
83
|
+
@apply text-gray-2;
|
84
|
+
}
|
85
|
+
|
86
|
+
dt + dd,
|
87
|
+
dd + dt {
|
88
|
+
@apply mt-4;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
.flash__message {
|
93
|
+
p {
|
94
|
+
@apply my-4;
|
95
|
+
}
|
96
|
+
|
97
|
+
ol {
|
98
|
+
@apply list-decimal;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
/* overwrite tom-select defaults */
|
103
|
+
.ts-control {
|
104
|
+
margin-bottom: 0.5rem;
|
105
|
+
}
|
106
|
+
|
107
|
+
.ts-dropdown {
|
108
|
+
margin: 0;
|
22
109
|
}
|
@@ -1,11 +1,5 @@
|
|
1
|
-
<div class="
|
1
|
+
<div class="form__wrapper">
|
2
2
|
<%= form.text_field :email, autofocus: true %>
|
3
|
-
</div>
|
4
|
-
|
5
|
-
<div class="field">
|
6
3
|
<%= form.password_field :password %>
|
7
|
-
</div>
|
8
|
-
|
9
|
-
<div class="field">
|
10
4
|
<%= form.password_field :password_confirmation %>
|
11
5
|
</div>
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<% add_decidim_page_title(t(".title")) %>
|
2
2
|
|
3
3
|
<% provide :title do %>
|
4
|
-
<
|
4
|
+
<h1 class="h1"><%= t ".title" %></h1>
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<%= decidim_form_for(@form) do |f| %>
|
8
8
|
<%= render partial: "form", object: f %>
|
9
9
|
|
10
|
-
<div class="
|
11
|
-
<%= f.submit t(".update") %>
|
10
|
+
<div class="form__wrapper-block">
|
11
|
+
<%= f.submit t(".update"), class: "button button__sm md:button__lg button__primary" %>
|
12
12
|
</div>
|
13
13
|
<% end %>
|