Commit Graph

18546 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
1e46746d6a Filter airbrake parameters
As Rails does with the application log and other tools. We
are going to use the same filtering rules we use in Consul Democracy.

We are renaming the initializer file name `filter_parameter_logging.rb` so
it's loaded before the errbit initializer.
2023-11-23 18:21:29 +01:00
Javi Martín
e0aee199e4 Merge pull request #5259 from consuldemocracy/dependabot/bundler/rubocop-capybara-2.19.0
Bump rubocop-capybara from 2.18.0 to 2.19.0
2023-11-14 14:31:00 +01:00
Sebastia
c816c51787 Merge pull request #5173 from consuldemocracy/budget_results
Replace back link on budget results
2023-11-14 10:08:31 +01:00
Javi Martín
5e7b5ccfd3 Add and apply Capybara/ClickLinkOrButtonStyle rule
This rule was added in rubocop-capybara 2.19.0. We were following it
most of the time.
2023-11-08 14:18:16 +01:00
Javi Martín
0cec581ec0 Add and apply Capybara/RSpec/HaveSelector rule
This rule was added in rubocop-capybara 2.19.0. We were following it
about 85% of the time.

Now we won't have to check both have_css and have_selector when
searching the code.
2023-11-08 14:18:16 +01:00
dependabot[bot]
83f3cbc143 Bump rubocop-capybara from 2.18.0 to 2.19.0
Bumps [rubocop-capybara](https://github.com/rubocop/rubocop-capybara) from 2.18.0 to 2.19.0.
- [Release notes](https://github.com/rubocop/rubocop-capybara/releases)
- [Changelog](https://github.com/rubocop/rubocop-capybara/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-capybara/compare/v2.18.0...v2.19.0)

---
updated-dependencies:
- dependency-name: rubocop-capybara
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-08 14:18:16 +01:00
Javi Martín
2d30f5180b Merge pull request #5268 from consuldemocracy/dependabot/bundler/rubocop-rspec-2.24.1
Bump rubocop-rspec from 2.23.2 to 2.24.1
2023-11-08 14:17:10 +01:00
Alberto
f563fc0b24 Replace back link on budget executions 2023-11-03 10:57:24 +01:00
Alberto
ea38b6d6c5 Replace back link on budget stats 2023-11-03 10:57:07 +01:00
Senén Rodero
09ca9720f5 Merge pull request #5302 from consuldemocracy/cabildo_tenerife_authetication_logs
ENS: Log successful and failed sign in attempts
2023-10-25 13:14:01 +02:00
Senén Rodero Rodríguez
9112d2d73b Include a timestamp in every authentication logger message 2023-10-25 10:13:04 +02:00
Senén Rodero Rodríguez
b7073691f1 Log successful and failed login attempts in a separate log file
We log the login parameter and the request IP address.

Quoting the ENS:

> [op.acc.5.r5.1] Se registrarán los accesos con éxito y los fallidos.
2023-10-25 10:13:03 +02:00
Javi Martín
b59899e9f7 Add and apply RSpec/MetadataStyle rubocop rule
This rule was introduced in rubocop-rspec 2.24.0. We were applying it
most of the time.
2023-10-24 22:59:05 +02:00
Javi Martín
013f3282e4 Use the RSpec/FilePath rule replacements
RSpec/FilePath is deprecated since rubocop-rspec 2.24.0 and will be
removed in rubocop-rspec 3.0 in favor of RSpec/SpecFilePathFormat and
RSpec/SpecFilePathSuffix.
2023-10-24 22:59:05 +02:00
dependabot[bot]
b44247b4e5 Bump rubocop-rspec from 2.23.2 to 2.24.1
Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.23.2 to 2.24.1.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.23.2...v2.24.1)

---
updated-dependencies:
- dependency-name: rubocop-rspec
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-24 22:59:05 +02:00
Javi Martín
2aff3b73f9 Merge pull request #5273 from consuldemocracy/lockable
ENS: Enable lockable devise module
2023-10-24 22:49:39 +02:00
taitus
d54a5c2ae0 Allow define maximum_attemps and unlock_in 2023-10-24 20:21:03 +02:00
taitus
873ec84b52 Allow disable devise lockable through secrets 2023-10-24 20:20:29 +02:00
taitus
a1955531e1 Enable devise lockable module with default values
In order to the display a warn text on the last attempt
before the account is locked, we need update
config.paranoid to false as the devise documentation
explains.

Adding "config.paranoid: false" implies further changes
to the code, so for now we unncomment the default value
"config.last_attempt_warning = true" and update it to false.
2023-10-24 20:20:27 +02:00
Sebastia
1d5312d2c8 Merge pull request #5163 from consuldemocracy/enable_password_complexity
ENS: Enable password complexity
2023-10-24 19:46:24 +02:00
taitus
7c771b28b5 Add password complexity 2023-10-24 19:00:43 +02:00
taitus
fe9da7988f Enable password_complexity
As it seems that adding complexity to the password is something that
might be wanted from the Consul applications, we added the necessary
changes to allow it.

In this version we simply:
- Uncomment the configuration variable "password_complexity"
- Set this variable without any restrictions
- Adapt the application so that everything still works normally.

One of the things that had to be done to adapt the application
was to remove the overwriting of the "self.included" method.

The original idea of overwriting the "self.included" method seems
to be the possibility of being able to overwrite the
:current_equal_password_validation validation.
The problem comes from the fact that by only calling that validation,
the rest of the validations that are defined (in this case
"password_complexity") are no longer applied.

It seems like a good idea to remove the overwrite of the "self.included"
method to allow all the defined validations to be applied and simply
overwrite the :current_equal_password_validation method so that
everything behaves the same.

:allow_passwords_equal_to_email configuration has been enabled too,
in order to allow existing records with this configuration.

Another change made was to uncomment the line:
and to keep everything working the same set the value to false:
config.email_validation = false.

This change has had to be made because in the documentation of
devise-security it says the following:
In other words, if we want to use the :secure_validatable module
we have to enable this configuration even if its value is "false".

If we kept the configuration variable commented out:
The following error appears:
"uninitialized constant Devise::Models::SecureValidatable::EmailValidator".

So it has been verified that if before making any change we
decommented the line and added the value of "false", the application
worked as normal.
2023-10-24 18:59:03 +02:00
taitus
56aadedc8c Update devise-security.rb
In these commits ffe9ac7 0d8def3 we updated the devise-security version.
In these versions the 'password_regex'  configuration key and some comments
were changed.

We update this file in order to use the new configuration key 'password_complexity' and keep comments updated.
2023-10-24 18:59:03 +02:00
Sebastia
c1e0d58291 Merge pull request #5274 from consuldemocracy/last-sign-in
ENS: Add security secret "last_sign_in"
2023-10-24 18:57:18 +02:00
Javi Martín
ce4939703e Merge pull request #5278 from consuldemocracy/vote_contrast
Make like/unlike buttons more accessible
2023-10-24 17:24:22 +02:00
Javi Martín
77802b90b2 Merge pull request #5282 from consuldemocracy/external_links
Open links in the same tab unless necessary
2023-10-24 17:21:08 +02:00
Javi Martín
827bb125b2 Explicitly open markdown links in the same window
We were already opening them in the same window because we were
accidentall sanitizing the `target` attribute, but now we're making the
point more explicit.
2023-10-24 16:41:03 +02:00
Javi Martín
aeff8a0f31 Don't open auto links in a new tab
Just like we aren't opening any external links in a new tab, only, in
this case, we don't even know whether these links are internal or
external.
2023-10-24 16:41:03 +02:00
Javi Martín
5aa56c054f Mark external links using the "rel" attribute
This will help search engines know these links point to external sites
and it'll make it possible to style these links using the
`[rel~=external]` selector. AFAIK, assistive techonologies don't use
this attribute to notify people about external links, though.
2023-10-24 16:41:03 +02:00
Javi Martín
79c1aa0755 Fix "rel" attribute in footer description links
We were accidentally filtering this attribute when sanitizing the text
since commit 928312e21.
2023-10-24 16:41:03 +02:00
Javi Martín
8053cc5e1c Open footer description links in the same window
This is a funny one, because we were accidentally opening them in the
same window without intending to do so since commit 928312e21, since the
`sanitize` method removes the `target` attribute. So the test we're
adding already passed without these changes.
2023-10-24 16:41:03 +02:00
Javi Martín
05345fb43c Extract methods in footer component
This way it'll be easier to change and refactor this code.
2023-10-24 16:41:03 +02:00
Javi Martín
219d71baaf Open links to external videos in the same window
Just like we're doing with other external links.

We already mention that it's an external video, so there's no need to
explicitly indicate it in the link.
2023-10-24 16:41:03 +02:00
Javi Martín
56d834783c Open links to social networks in the same window
As mentioned in earlier commits, opening external links in a new
tab/window results in usability and accessibility issues.

Since these links are usually at the top or bottom of the page and
contain icons of well-known sites, IMHO there's no need to even notify
people that these are external links.

Since we're no longer using the `shared.target_blank` translation inside
a sentence, we can remove the space and parenthesis in the translations.
2023-10-24 16:41:03 +02:00
Javi Martín
44f4bdf772 Open links to download files in the same tab
Just like we did for documents in commit cdc5e05d4.
2023-10-24 16:40:52 +02:00
Javi Martín
d5c6d1ffab Open links to images in the same tab
Just like we did for documents in commit cdc5e05d4.
2023-10-24 16:34:29 +02:00
Javi Martín
0edfd0cab5 Open management links in the same window
We were doing it this way because managers usually have the management
section open at all times. However, this might not always be the case,
and by opening links in a new tab, we're taking control away from them.

If managers would like to keep the management section open, they can
open the link in a new tab, and if they open it in the same tab, they
can go back to the management section by either clicking the browser's
back button or clicking on the navigation link to the management
section.
2023-10-24 16:31:39 +02:00
Javi Martín
87d7923f0d Open mailer links in the same window
We do it most of the time, so I'm not sure why we weren't doing it in
these cases.
2023-10-24 16:31:39 +02:00
Javi Martín
3753c42ab2 Open moderation links in the same window
Note that, unlike what we did in the admin section we're opening links
to budget investments on the same tab. There are two reasons for it; the
first one is that, in this case, there are no filters in the moderation
section that are lost after editing an investment, and the second one is
that, in this context, administrators usually don't go to the investment
in order to edit it, so they can just check something and use the
browser's back button to go back.
2023-10-24 16:31:39 +02:00
Javi Martín
5c7d87f763 Open admin links in the same window
In the admin section, when clicking on a link that leads to a page in
the public area, sometimes the page was opened in the same window and
sometimes it would open in a new window, with no clear criteria
regarding when either scenario would take place.

This was really confusing, so now we're more consistent and open
(almost) every link in the same window. The main reason behind it is
simple: if we add `target: _blank`, people who want to open those links
in the same window can no longer do so, so we're taking control away
from them. However, if we don't add this attribute, people can choose
whether to open the link on the same tab or to open it on a new one,
since all browsers implement a method to do so.

More reasons behind this decision can be found in "Opening Links in New
Browser Windows and Tabs" [1].

We're keeping some exceptions, though:

* Opening the link to edit an investment on the same tab would result in
  losing all the investment filters already applied when searching for
  investments, so until we implement a way to keep these filters, we're
  also opening the link to edit an investment in a new tab
* For now, we're also opening links to download files in a new window;
  we'll deal with this case in the future

[1] https://www.nngroup.com/articles/new-browser-windows-and-tabs/
2023-10-24 16:31:39 +02:00
Javi Martín
f21eca4ccc Open custom dashboard links in the same window
We were opening these links in a new tab/window because we assume they
were external links.

But, on the one hand, we don't even know whether these links are
external, since they could also point to URLs from our site. And, on the
other hand, opening external links in new windows results in usability
issues as well [1, 2].

On top of that, old browsers have security issues when opening links in
new tabs unless we add `rel="noopener"` [3], and we aren't doing so.

[1] https://www.nngroup.com/articles/new-browser-windows-and-tabs
[2] https://css-tricks.com/use-target_blank
[3] https://mathiasbynens.github.io/rel-noopener/
2023-10-24 16:31:39 +02:00
Javi Martín
0c14feee19 Open proposals dashboard links in the same window
Out of the usability issues I've experienced when using Consul
Democracy, the biggest one has arguably been the fact that the link to
edit a proposal opens in a new tab. I guess the reasoning behind it is
that the page to edit a proposal is not part of the proposals dashboard,
but what the hell! Imagine if every link to edit something opened in a
new tab...

So we're reducing the impact of this nonsense by opening most dashboard
links in the same window; for now, we're still opening in a new window
links to download files and links that might point to external websites.
We'll address those ones in the future.
2023-10-24 16:31:39 +02:00
Javi Martín
ef7486ddc6 Remove empty link in mailer layout
This link was opening the current page in a new window, which is pretty
useless IMHO.
2023-10-24 16:31:39 +02:00
Javi Martín
2e217a647a Merge pull request #5283 from consuldemocracy/label_links
Allow links in forms to open in new tabs
2023-10-24 16:30:59 +02:00
Javi Martín
bc1f303551 Merge pull request #5281 from consuldemocracy/pdf_links
Open PDF files in the same tab/window
2023-10-24 16:28:31 +02:00
Javi Martín
9b50173ebd Merge pull request #5284 from consuldemocracy/debian_bullseye
Use Debian Bullseye instead of Buster on Docker
2023-10-24 15:25:39 +02:00
Senén Rodero
f36248fad6 Merge pull request #5303 from consuldemocracy/fix_fnm_setup
Map node binaries whenever `rvm1:hook` is called and evaluate the `fnm_setup_command` dynamically
2023-10-24 15:24:33 +02:00
Javi Martín
834da50901 Merge pull request #5279 from jensconsul/admin_panel_branch
Add information about the project to admin index
2023-10-24 15:23:33 +02:00
Senén Rodero Rodríguez
ddc8cfdfb0 Map node binaries whenever rvm1:hook is called and evaluate the fnm_setup_command dynamically
The previous version worked fine when using Capistrano to deploy a new
release, but it did not work for other commands, like `cap npm install`
or `cap puma:start`, as they do not create a release. Therefore, the
`git:create_release` was never called, and the `map_node_bins` was not
invoked.

Since we need node binaries available to the deploy user when executing
any process that runs the application, like puma, delayed_job, and rake
tasks, among others, it makes sense to load FNM to use the correct Node
version in the same places where Capistrano loads RVM to load the correct
Ruby version.

With dynamic loading of the `fnm_setup_command`, we get the correct path
when deploying a new release and also when running any other capistrano
command that does not deploy a new release.
2023-10-24 12:59:53 +02:00
Javi Martín
c2710de5fc Extract method to open links in a new window
This way we can slightly simplify the code.
2023-10-23 18:19:48 +02:00