Commit Graph

3554 Commits

Author SHA1 Message Date
Leonardo Tegon
c116542c28 Update tests to use safe redirects 2019-01-22 17:21:32 -02:00
Leonardo Tegon
c000b58c56 Add Rails 6 to CI (#5009) 2019-01-22 12:43:31 -02:00
Matthew Rudy Jacobs
40e8812d75 Apply Test Helper fix to Rails 6.0 as well as 5.x (#5002) 2019-01-17 18:29:00 -02:00
Felipe Renan
cc6046b8cc Merge pull request #5005 from plataformatec/frg-fix-travis-build
Fix travis build
2019-01-17 18:26:54 -02:00
Felipe Renan
6b1ead8654 Fix travis build
Now Travis uses bundler 2.0+ and it causes some build fails since we
still support Rails 4.

This commit set Travis to not use a bundler version higher than 2.0.

More info: https://docs.travis-ci.com/user/languages/ruby/#bundler-20
2019-01-17 17:45:12 -02:00
Patrick Jones
518f6f39bf Fixed broken README link in changelog [ci skip] (#4999) 2019-01-10 11:09:51 -02:00
Rafael França
6edbeb82cd Merge pull request #4998 from Atul9/update-license
Update copyright notice to 2019 [ci skip]
2019-01-07 14:23:26 -05:00
Atul Bhosale
a8d0a8f63d Update copyright notice to 2019 [ci skip] 2019-01-07 23:28:19 +05:30
Leonardo Tegon
62703943be Make #increment_failed_attempts concurrency safe (#4996)
As reported in #4981, the method `#increment_failed_attempts` of `Devise::Models::Lockable` was
not concurrency safe. The increment operation was being done in two steps: first the value was read from the database, and then incremented by 1. This may result in wrong values if two requests try to update the value concurrently. For example:

```
Browser1 -------> Read `failed_attempts` from DB (1) -------> Increment `failed_attempts` to 2
    Browser2 -------> Read `failed_attempts` from DB (1) -------> Increment `failed_attempts` to 2
```

In the example above, `failed_attempts` should have been set to 3, but it will be set to 2. 

This commit handles this case by calling `ActiveRecord::CounterCache.increment_counter` method, which will do both steps at once, reading the value straight from the database.

This commit also adds a `ActiveRecord::AttributeMethods::Dirty#reload` call to ensure that the application gets the updated value - i.e. that other request might have updated. 
Although this does not ensure that the value is in fact the most recent one - other request could've updated it after the `reload` call - it seems good enough for this implementation. 
Even if a request does not locks the account because it has a stale value, the next one - that updated that value - will do it. That's why we decided not to use a pessimistic lock here.

Closes #4981.
2018-12-28 17:00:50 -02:00
kenji kobayashi
e3a00b27d1 Add an option to not automatically sign in a user after changing a password (#4569) 2018-12-28 11:29:58 -02:00
Pavel Pestau
8266e85576 Removing extra characters (#4991) 2018-12-21 10:18:05 -02:00
Pavel Pestau
4372dd402b Removed extra characters (#4988) 2018-12-20 11:51:19 -02:00
Marcos Ferreira
6e4b0b94bc Don't run gem update --system and gem install bundler on CI
There were some issues with the combination of some `bundler` and `rubygems` versions.
We got around that by always updating `bundler` in the CI but since those issues
were fixed we can quit doing that.

Related to `gem update --system`:
- travis-ci/travis-ci#8978
- rubygems/rubygems#2123

Related to `gem install bundler`:
- travis-ci/travis-ci#9333
- travis-ci/travis-ci#8969
- bundler/bundler#6340
2018-12-19 17:04:56 -02:00
Leonardo Tegon
bf74a506c8 Update CHANGELOG.md [ci skip] 2018-12-19 10:32:50 -02:00
Marcos Ferreira
e01fb8bb22 Merge pull request #4989 from plataformatec/mf-fix-unclosed-tag-error-messages-partial
Fix unclosed html tag and add deprecation warn
2018-12-19 09:52:10 -02:00
Marcos Ferreira
14785afe8d Add a deprecation warn for DeviseHelper.devise_error_messages!
To customize the error style one should modifying the
`devise/shared/error_messages` partial.
2018-12-18 21:15:13 -02:00
Marcos Ferreira
66a96ab9d6 Fix unclosed li tag in error_messages partial 2018-12-18 21:15:11 -02:00
Graham Brereton
76b87dc0e8 Refactor the devise_error_messages! helper to render a partial (#4616)
This should make it more intuitive and easier for developers using the
project to implement their own layout for errors.
2018-12-18 21:01:16 -02:00
Leonardo Tegon
cb663e96a3 Update CHANGELOG.md [ci skip] 2018-12-04 14:37:20 -02:00
Stan Hu
1192c76f62 Fix corner case when confirmation_sent_at is equal to 0.days.ago (#4529)
If `Confirmable#confirmation_sent_at` is equal to `0.days.ago`, then
`confirmation_period_valid?` will be deemed valid even if the setting is
configured to disable this outright. To prevent this error, we explicitly
check the configuration setting to be `0.days.ago`.
2018-12-04 14:34:32 -02:00
Leonardo Tegon
ecd2187652 Update CHANGELOG.md [ci skip] 2018-11-30 17:43:28 -02:00
ihatov08
d1571627b7 Add deprication waring if use options argument at DatabaseAuthenticatable#update_with_password,#update_without_password (#4935) 2018-11-28 17:58:10 -02:00
Leonardo Tegon
52b24e41de Fix typo [ci skip] 2018-11-23 13:26:26 -02:00
Leonardo Tegon
5f62f28d6e Explain the code that prevents enumeration attacks 2018-11-22 20:38:02 -02:00
Jason Lee
c84169122f Ignore useless files into the gem file. (#4955) 2018-11-22 20:04:53 -02:00
Kanmaniselvan Murugesan
bafc23eae5 Issue 4895: Add after_database_authentication callback after sign_in immediately after password update (#4916) 2018-11-22 19:13:55 -02:00
Leonardo Tegon
aa6cb411bc Add missing specs for #find_or_initialize_with_errors
After merging https://github.com/plataformatec/devise/pull/4797, I
noticed that we had no specs for the scenarios where this method was
adding the errors to the resource. This commit adds tests to cover those
cases.
2018-11-22 18:44:09 -02:00
Ryan Lue
354df3bc65 [bugfix] [refactoring] Sanitize parameters in find_or_initialize_with_errors (#4797)
* Use parameter sanitizer for new records in find_or_initialize_with_errors

* Add test for find_or_initialize_with_errors bugfix
2018-11-22 15:10:50 -02:00
Kopylov Vladislav
6f140faf0d fixed description for Devise::Generators::ControllersGenerator (#4975) 2018-11-21 19:20:23 -02:00
Leonardo Tegon
05bf574799 Add more tests (#4970)
After merging #4261, I realized that we could add a couple more
tests, to ensure the new behavior added to `#valid_password?` - which is
that it should return `false` when the password is either `nil` or blank
('').
I've also removed [this
condition](https://github.com/plataformatec/devise/blob/master/lib/devise/models/database_authenticatable.rb#L68)
because it's already present at `Devise::Encryptor` module in the
`.compare`
[method](https://github.com/plataformatec/devise/blob/master/lib/devise/encryptor.rb#L15).
2018-11-13 15:29:14 -02:00
Colin Ross
40f02ae69b Only flash if the request object that is loaded supports it (#4950) 2018-11-13 15:26:00 -02:00
sivagollapalli
3aedbf0a4d [#4245] Allowing password to nil (#4261)
* [#4245] Allowing password to nil

* Set encrypted password to nil if password is nil

* [#4245] Fixing the build

* Removed unnecessary code
2018-11-13 13:57:23 -02:00
John Gabriel
fa067b31c6 chore(docs): allow_unconfirmed_access_for = nil (#2275) (#4964) 2018-11-12 14:27:27 -02:00
Vasiliy Ermolovich
517010e2c5 Merge pull request #4961 from HarlemSquirrel/issue-template-20181028
Fix Issue template grammar
2018-10-28 21:01:28 +03:00
Vasiliy Ermolovich
4adc792422 Merge pull request #4960 from HarlemSquirrel/contributing-20181028
Fix CONTRIBUTING.md typo
2018-10-28 19:51:59 +03:00
Kevin McCormack
0640b318ca Fix Issue template grammar 2018-10-28 12:41:08 -04:00
Kevin McCormack
95fad8b408 Fix CONTRIBUTING.md typo 2018-10-28 12:36:00 -04:00
Sam Weerasinghe
94adec3cee Issue #4941 , handle error 'Please specify the Rails release the migration was written for' (#4942) 2018-10-03 15:21:59 -03:00
Ieva S
87b73540a4 Updated year in MIT-LICENSE (#4948) 2018-10-01 08:38:41 -03:00
Isaac Orme
25f908ad9c issue 4526 adds skip email and password change notifications methods (#4824) 2018-09-28 18:55:00 -03:00
Rafael França
4656e96d9e Merge pull request #4938 from colinross/issue-#4931-missing-comma
Missing comma in form input
2018-09-19 22:03:22 -04:00
Colin Ross
389cd85d47 Missing comma in form input 2018-09-19 18:19:56 -07:00
Leonardo Tegon
3b0bc08ec6 Prepare for 4.5.0 release v4.5.0 2018-08-15 20:03:08 -03:00
Leonardo Tegon
2eca92f950 Update CHANGELOG.md 2018-08-15 17:05:50 -03:00
Isaac Orme
acc45c5a44 issue 4356 adds is_navigational_format? check to after_sign_up_path_for (#4833) 2018-08-02 11:02:50 -03:00
Guillaume CABANEL
e4dd1509c4 Update README.md (#4911)
update links to rubydoc.info to the url `www.rubydoc.info` since the ssl certificate is only valid for www.rubydoc.info (not rubydoc.info)
2018-07-31 11:36:42 -03:00
Phil Nash
b8f644198d Corrects brakes -> breaks when talking about tests (#4897) 2018-07-03 09:52:07 -03:00
lucfranken
715192a770 Improve getting started text on Gemfile (#4875)
The original text: 

> You can add it to your Gemfile with:

Could easily be read as: "Run this command to add it to your Gemfile"

That's what I did at least. I think the change makes it much clearer that you need to really manually add a line of text into the Gemfile.

One of the reasons why this is not fully clear is that it's badly visible on Github whether a command is a console / terminal command or a ruby line of code. Visually they look the same except for the $ sign which is easy to overlook.
2018-05-16 14:48:24 -03:00
Josh Pencheon
31aceeb104 Fix bug: ParameterFilter should not add keys (#3431) (#4457)
If called with a hash that has a `default` / `default_proc`
configured, `Devise::ParameterFilter` can add in missing keys
it was due to attempt to sanitise the values for.

This patch prevents this from happening, whilst also clarifying
the filtering intent of `ParamaterFilter`.

(This can also occur if NilClass has been augmented with definitions
for `strip` or `downcase`.)

Fixes #3431.
2018-05-15 10:47:18 -03:00
Samy Kacimi
af8f7e9797 remove :trackable from the default modules (#4857)
This removes :trackable from the default modules in the generators,
to be more GDPR-friendly.
2018-05-14 18:11:15 -03:00