Commit Graph

27 Commits

Author SHA1 Message Date
Javi Martín
57d8a59d10 Add an apply Style/RaiseArgs rubocop rule
We were already applying it most of the time.
2021-08-09 17:32:46 +02:00
taitus
e2138145a5 Avoid management actions when no user is selected
Many management actions only make sense if a user has been selected
beforehand.

We updated :check_verified_user method to be able to check  actions that need to
have a user selected in order to avoid exceptions.

We need this control as :only_verified_user is not restrictive enough. The reason is
that the :managed_user method used in the :only_verified_user if it does not find a
user it does an initializce (find_or_initialize_by). This causes that when we have
"skip_verification" to true, it returns this non-persisted user as "verified".

These changes affect the actions of Account, Budgets and Proposals Controller
when no user is selected.
2021-04-07 20:49:31 +02:00
Javi Martín
305bf9161c Enable forgery protection in ActionController
We were manually adding forgery protection to all our controllers, but
in Rails 5.2 there's an option (enabled by default for new applications)
which adds this protection to all controllers.
2020-10-15 14:57:42 +02:00
Javi Martín
002e9239d0 Simplify code involving Globalize.locale
We don't need to set this value. In commit f2ef27d3 I made a mistake
thinking `Globalize.locale` and `I18n.locale` should always be in sync,
but they're actually automatically in sync when `Globalize.locale` is
`nil`.

So the best way to avoid any issues is not to assign `Globalize.locale`,
and use `Globalize.with_locale` where necessary instead.
2020-06-25 19:37:57 +02:00
Javi Martín
58157beb01 Add CSRF protection to management controllers 2019-11-13 01:33:56 +01:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
ae6fab9f5e Inherit from builder instead of monkey patching it
We were monkey-patching FoundationRailsHelper::Formbuilder, which made
form customization difficult. We can inherit from it, which is the
standard way of extending what an existing class does, and make our form
the default one.
2019-10-05 16:01:58 +02:00
Senén Rodero Rodríguez
8c2f1b894d Add controller concern to initialize Globalize fallbacks
Ensure to initialize all requests including this concern into all
application base controllers.
2019-06-27 09:20:24 +02:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Javier Martín
157cd001d5 Add spec to expose a bug finding manager logged in
I've moved the method to the User model in order to make it easier to
test. I'm not sure where it belongs, though.

There was already a failing spec in `spec/features/management_spec.rb`,
but it passed if run standalone because it only failed if previous tests
had already created nine users or more.
2018-07-28 22:03:33 +02:00
iagirre
2fafceb81d Errors after running Travis fixed 2018-07-15 17:35:30 -04:00
iagirre
7a7ae5fa2e The admin menu is shown in the management section if the user who logged in is an admin 2018-07-15 17:32:30 -04:00
Javier Martín
f2ef27d3ae Always set Globalize.locale after I18n.locale.
The test "Budget Investments Show milestones" was failing in certain
cases where `Globalize.locale` had been changed in a previous test.

Since having different values in `Globalize.locale` and `I18n.locale`
has proven to be an issue on the test enviroment, this commit also
changes application code in order to avoid similar situations on
production.

See issue #2718.
2018-07-03 00:52:20 +02:00
iagirre
e8b91356b3 Backend functionality to let managers update users password
The back button when the user changes the password
(in the print password page) redirects to the
edit manually page.

The routes to access password edit pages has been added,
along with the ones to send reset password email and
reset password manually.
2018-04-02 09:43:24 +02:00
rgarcia
952df2947a Duplicate current_budget method in management_base_controller
This method is already existent in the application_controller but it
seems a little overkill to create a concern just for this method

Maybe when we have multiple method it makes sense to create a nice
controller. Another option would be to make the
management_base_controller extend from the application_controller
2018-01-17 12:50:17 +01:00
Bertocq
4e0d88739d Fix Rails/Blank rubocop issue 2017-07-10 23:02:27 +02:00
Juanjo Bazán
585f3dd6c7 removes use of current_user in management
favors managed_user
to avoid conflicts with logged admin users
2016-04-27 17:26:19 +02:00
Juanjo Bazán
991b189610 refactors triplicated code 2016-04-08 12:16:09 +02:00
Juanjo Bazán
510d85cf97 unifies session key 2015-10-23 14:05:23 +02:00
Juanjo Bazán
854499b135 adds localization to management 2015-10-23 13:36:43 +02:00
Juanjo Bazán
89cc26c261 adds managers login via ManagerAuthenticators 2015-10-15 15:57:53 +02:00
rgarcia
bca26b2b50 changes current_user for managed_user 2015-10-13 13:58:01 +02:00
rgarcia
f55c3974aa refactors managed user info into management layout 2015-10-12 14:05:06 +02:00
rgarcia
5feef066dc adds managed user to session 2015-10-11 16:56:16 +02:00
Juanjo Bazán
7b3d3243b8 adds management layout 2015-10-06 14:32:01 +02:00
Juanjo Bazán
20bf9d7186 adds auth before filter to verify manager 2015-10-01 17:59:36 +02:00
Juanjo Bazán
39119b9d6b adds base controller for management 2015-09-29 17:34:17 +02:00