Commit Graph

12 Commits

Author SHA1 Message Date
Iraline
ac16bd9395 Merge branch 'fix_confirmation_token_2746' of https://github.com/iraline/consul into fix_confirmation_token_2746 2022-04-27 12:06:09 -03:00
Iraline
985ab4faad Tests to validate the flow of token already used 2022-04-27 12:04:16 -03:00
Julian Herrero
ad018c6f39 Send informative email for already confirmed users
Currently the application does not send any email to confirm the
account for already confirmed users. But we show a notice message
that may look like you will recive one:

"If your email address exists in our database, you will receive
 an email with instructions for how to confirm your email address
 in a few minutes."

In this commit we keep the original message, but send an email to
the user informing them that their account is now registered.

This way no one can know if someone else's account is confirmed and
we don't have to worry about GDPR either.

Co-Authored-By: taitus <sebastia.roig@gmail.com>
2022-04-19 17:03:02 +02:00
taitus
d0571a4a73 Improve confirmation instructions texts
The texts for the confirmation instructions referred to "reset the password".
We have updated the texts to refer to confirmation instructions.
2022-04-19 16:53:30 +02:00
taitus
0493893ab8 Fix send confirmation instructions on do_finish_signup action
When we try to register with omniauth and the email or username already exists,
we use the finish_signup and do_finish_signup actions to allow the user to choose
another email or username.

The do_finish_signup action of the registration controller calls the
send_oauth_confirmation_instructions method which is responsible for sending the
confirmation email.

In this method we were only validating the case that the email is duplicated. Now
we add one more condition that allows us to send the instructions for the case in
which we have had to change our username.
2021-10-11 12:28:51 +02:00
taitus
ba4595f6ce Use the label text in the specs
Using the label text in the specs is superior to using the name because it tests the label is correctly associated to its form control.
2021-10-11 12:27:18 +02:00
Javi Martín
9890571091 Use login form in tests checking expired passwords
The controller provided by the `devise-security` gem which tests
password is expired does not execute the `before_action` we have in our
application controller. That means it doesn't set the current locale.

We were having issues in the tests checking this behavior if the
previous test had set the current locale to a different one. This meant
the process running the browser had one locale while the process running
the test had a different one, which resulted in a page in English (as
expected), only the flash message notifying users their password expired
was in a different language.

To reproduce this behavior, run:

```
rspec './spec/system/welcome_spec.rb[1:1:2:2:1]' spec/system/users_auth_spec.rb:623 --order defined
```

I'm not sure whether this is a bug or it's a problem with the tests. In
theory it might be possible to reproduce a similar behavior in
production due to what we mention about the controller not executing the
`set_current_locale` method. But I haven't been able to reproduce the
situation, particularly since the password expiration seems to be
checked exclusively at login time (that is, if you stay logged in for 10
years, your password doesn't seem to expire).

So for now I'm just making the tests pass by using the login form
instead of using `login_as`.
2021-04-16 14:37:58 +02:00
Javi Martín
92ddcb7aef Use JavaScript in system tests by default
JavaScript is used by about 98% of web users, so by testing without it
enabled, we're only testing that the application works for a very
reduced number of users.

We proceeded this way in the past because CONSUL started using Rails 4.2
and truncating the database between JavaScript tests with database
cleaner, which made these tests terribly slow.

When we upgraded to Rails 5.1 and introduced system tests, we started
using database transactions in JavaScript tests, making these tests much
faster. So now we can use JavaScript tests everywhere without critically
slowing down our test suite.
2021-04-07 14:41:06 +02:00
Javi Martín
cdd70a6116 Use JavaScript in tests with flash messages
So now we feel in the tests the same usability problems users feel when
they want to click a link and the flash message is in their way.
2021-04-07 14:41:06 +02:00
Javi Martín
6a509a7437 Use UTF characters in the BMP in tests
ChromeDriver only supports characters in the BMP (Basic Multilingual
Plane). One test fails with ChromeDriver because it was entering emojis.

I'm using kanji characters instead, although I must admit I'm not sure
why such an unusual login was used in the first place.
2021-04-07 14:32:49 +02:00
Julian Herrero
b7b05b55fe Show Wordpress login button if it's the only one enabled 2020-07-27 14:47:42 +02:00
Javi Martín
9427f01442 Use system specs instead of feature specs
We get rid of database cleaner, and JavaScript tests are faster because
between tests we now rollback transactions instead of truncating the
database.
2020-04-24 15:43:54 +02:00