Commit Graph

36 Commits

Author SHA1 Message Date
Javi Martín
a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00
Iraline
5eb2dc5a9c adding limitation to not save blank email in model 2022-06-07 14:17:37 -03:00
Javi Martín
11832cc07d Make it easier to customize allowed parameters
When customizing CONSUL, one of the most common actions is adding a new
field to a form.

This requires modifying the permitted/allowed parameters. However, in
most cases, the method returning these parameters returned an instance
of `ActionController::Parameters`, so adding more parameters to it
wasn't easy.

So customizing the code required copying the method returning those
parameters and adding the new ones. For example:

```
def something_params
  params.require(:something).permit(
    :one_consul_attribute,
    :another_consul_attribute,
    :my_custom_attribute
  )
end
```

This meant that, if the `something_params` method changed in CONSUL, the
customization of this method had to be updated as well.

So we're extracting the logic returning the parameters to a method which
returns an array. Now this code can be customized without copying the
original method:

```
alias_method :consul_allowed_params, :allowed_params

def allowed_params
  consul_allowed_params + [:my_custom_attribute]
end
```
2022-04-07 19:35:40 +02: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
27468b0b7b Use relative URLs where possible
In general, we always use relative URLs (using `_path`), but sometimes
we were accidentally using absolute URLs (using `_url`). It's been
reported i might cause some isuses if accepting both HTTP and HTTPS
connections, although we've never seen the case.

In any case, this change makes the code more consistent and makes the
generated HTML cleaner.
2019-10-20 17:26:14 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
rgarcia
c6ab5dbe1b Remove before_filter deprecation warning
DEPRECATION WARNING: before_filter is deprecated and will be removed in
Rails 5.1. Use before_action instead. (called from
<class:RegistrationsController> at
/home/travis/build/consul/consul/app/controllers/users/registrations_con
troller.rb:3)
2019-04-17 17:40:55 +02:00
rgarcia
4bce38bd64 Fix deprecated devise syntax
https://stackoverflow.com/questions/37341967/rails-5-undefined-method-fo
r-for-devise-on-line-devise-parameter-sanitizer
2019-04-16 17:28:07 +02:00
decabeza
cf7155613e Changes honeypot family name to address on users sign up form 2018-12-21 11:34:12 +01:00
rgarcia
5a041e89c4 Fix change email address
Not sure how this error creeped in 😕 probably a new gem version or
other conflicting code

The problem was we were getting an `unpermitted param email` when
updating a user’s email address

This stackoverflow solution seems to work nicely 😌
https://stackoverflow.com/questions/17384289/unpermitted-parameters-addi
ng-new-fields-to-devise-in-rails-4-0#answer-19036427
2018-04-04 14:01:51 +02:00
Bertocq
3a54713ed0 Fix all Rails/DynamicFindBy rubocop issues 2017-07-10 23:04:27 +02:00
kikito
9ac6e2d60b Uses invisible_captcha's default "foo fast" action 2016-04-28 12:47:04 +02:00
kikito
303b17c238 Adds invisible_captcha to user & organization registrations 2016-04-27 16:13:50 +02:00
kikito
dea1a28a69 purges simple_captcha 2016-04-27 16:07:47 +02:00
Juanjo Bazán
87662b3873 makes sure no blank redeemable codes are db stored 2016-02-26 17:55:34 +01:00
kikito
49dec60615 adds a redeemable code to users. It can be filled up when signing up from /cuentasegura 2016-02-22 17:41:08 +01:00
kikito
a796dade7a extracts methods into user.rb 2016-01-26 19:48:01 +01:00
kikito
a606c7aa8d Renames confirmed_oauth_email to oauth_email
Refactors the way oauth_email is used to cover more cases (fixes pending specs)
2016-01-26 18:15:40 +01:00
kikito
98f99954e7 Corrects the logic dealing with confirmations of users via oauth 2016-01-26 18:15:39 +01:00
kikito
7615dc066b Uses registering_with_oauth persistent attribute to deactivate checks in certain occasions 2016-01-26 18:11:11 +01:00
Josep Jaume Rey Peroy
cf00f12ec7 Store locale in a user's field and switch locale on mailers 2016-01-22 18:10:28 +01:00
Julian Herrero
7bbfcd74e2 check if username is available in registration form 2016-01-10 19:17:20 +01:00
rgarcia
d54abb5dfe simplifies erase action 2015-10-20 12:57:12 +02:00
kikito
f7f0dc17dd Fixes implementation bug when erasing account 2015-10-19 20:14:09 +02:00
kikito
9cc158540e implements a first version of the forms. Missing: a) tests and b) check db constraints (duplicate email "", etc) 2015-10-16 20:04:16 +02:00
kikito
980728279f Adds registration "success" intermediate page 2015-09-07 17:23:59 +02:00
rgarcia
17ce1f9d07 adds terms of service to users 2015-09-07 01:00:43 +02:00
rgarcia
10127f546e upgrade before_filter to new syntax 2015-09-03 01:40:24 +02:00
rgarcia
171150bcf5 displays email sent flash after sign up 2015-08-29 15:48:03 +02:00
David Gil
8d0ba2fe33 cleans up unused variable 2015-08-25 15:07:36 +02:00
David Gil
ddcef1a0f2 remove unused and locales 2015-08-24 20:24:54 +02:00
David Gil
158e203936 adds omniauth basic authentication process with Twitter, including an intermediate step to ask the user for her email if not provided by the OAuth provider - Twitter, for instance 2015-08-24 20:24:54 +02:00
Juanjo Bazán
b396a3b415 refactors user's registration
Simplifies process and fields: 

* In: username
* Out: first_name, last_name, phone, nickname, use_nickname?

Closes #213
2015-08-21 16:41:08 +02:00
kikito
8ca546a431 merges master and fixes conflicts 2015-08-17 02:40:11 +02:00
kikito
543f718891 Adds phone_number to the regular user registration / account views 2015-08-17 01:16:08 +02:00
kikito
de73eac2d0 Moves the registrations controller to users/registrations
This is necessary because rails gets confused when it has a a “root”
registration_controller and another non-root one. The non-root one uses
the views from the root.
2015-08-17 01:16:07 +02:00