Commit Graph

3925 Commits

Author SHA1 Message Date
Carlos Antonio da Silva
dd7ee27f74 Bring back Mongoid official support (#5568)
Devise hasn't been tested with Mongoid since Rails version 5, only 4.x was still running those tests.

This enables the tests again on all currently supported Rails versions, with their respective mongoid supported versions. There were a couple of minor tweaks to make it happen, namely:

* The way we were dropping the session before doesn't work in later versions so I changed back to calling `purge!` which appears to work fine. We used to call `Mongoid.purge!` but that changed in #4686.
* Some of the configs in the Rails test app were setting Active Record values when outside of the AR ORM tests, updated those to make sure they are not set when running mongoid ORM tests.
* The validations added to the shared admin code in tests were only checking for Rails version 5.1, but we need to use the same check for AR 5.1 that is used in code, otherwise it will try to use methods not available in mongoid there.
2025-10-31 11:16:02 -03:00
Fuyutsubaki
b76d18d277 Fixed inconsistency between description and example in 'Running tests' section (#5802)
Expand test run examples to show running a specific line number or a matching regex.

[ci skip]
2025-10-31 09:44:11 -03:00
Carlos Antonio da Silva
f150357c1c Test with the released version of v7.0
Rails just released v7.0.10 which contains the fixes for Ruby 3.4 we
needed to get the build green, so no need to point to GH anymore.

https://rubyonrails.org/2025/10/29/new-rails-releases-and-end-of-support-announcement

Note that v7.0 has reached EOL for a while now.
2025-10-29 10:31:23 -03:00
Carlos Antonio da Silva
d60f810086 Use currently released version of rails-controller-testing
We pointed to github to fix issues with Ruby 2.7 and kwargs, but since
then a version 1.0.5 was released which includes those fixes.

There's a few more things in their main, but nothing we need if all is
green.
2025-10-24 11:36:46 -03:00
Carlos Antonio da Silva
5a82ad5740 Fix nokogiri deprecation warning
./devise/test/support/webrat/matchers.rb:6: warning:
    Nokogiri::CSS.parse is deprecated and will be removed in a future
    version of Nokogiri. Use Nokogiri::CSS::Parser#parse instead.
2025-10-24 11:33:57 -03:00
Carlos Antonio da Silva
1cf31d45eb Update to test with Rails v8.1.0 final 2025-10-24 11:23:10 -03:00
Carlos Antonio da Silva
141ef37339 Add Ruby 3.4 & build updates (#5801)
Update bundle to avoid 3.4 mutex_m require error.

Test against Rails 7.0 branch which contains Ruby 3.4 fixes.

Update changelog to mention Rails < 7.0 support being dropped.

Builds on top of https://github.com/heartcombo/devise/pull/5770
Closes https://github.com/heartcombo/devise/pull/5776
Closes https://github.com/heartcombo/devise/pull/5761
2025-10-21 17:28:05 -03:00
Greg Molnar
dbc8e77ea0 Make test suite work (#5770)
* Drop support for Rails < 7 and Ruby < 2.7
* Add tests to support to Rails 8+
* Fix test suite across all supported versions
2025-10-21 16:52:04 -03:00
Carlos Antonio da Silva
9c5e4d3c4e Update to new email, copyright, supported Ruby/Rails versions
Also remove contributors section and add supported ruby/rails versions
to the readme.

[ci skip]
2025-10-17 14:22:02 -03:00
soma-git-practice
fa4749dddc Expand reconfirmable comment on generator to match the module doc (#5748)
Explain the combined usage of `reconfirmable` with `send_email_changed_notification`.
[ci skip]
2025-10-17 13:41:42 -03:00
Carlos Antonio da Silva
b02bb5b75a Merge pull request #5746 from c960657/config-warden
Update argument name for config.warden [ci skip]

The argument for the block passed to `config.warden` is no a `Warden::Manager` instance but a `Warden::Config` instance, but it is confusingly named `manager` in the generated file.

Renaming this to `warden_config` for clarity.
2025-10-17 12:06:43 -03:00
Carlos Antonio da Silva
23058dcc62 Merge pull request #5738 from soma-git-practice/is_this_typo_models_in_lockable
Fix typo in comments [ci skip]
2025-10-16 10:17:40 -03:00
Carlos Antonio da Silva
cf93de390a Fix links to RubyDoc
Closes #5778
[ci skip]
2025-05-28 08:51:42 -03:00
Christian Schmidt
46cae66baf Update argument name for config.warden 2024-12-17 13:31:17 +01:00
soma
a78ad3f20c Fix typo in comments 2024-12-04 23:04:03 +09:00
Vasiliy Ermolovich
fec67f98f2 Merge pull request #5734 from heartcombo/password-length-dynamic
Use proc to set password length validator so it's possible to override it dynamically.
2024-11-29 13:15:22 +00:00
Vasiliy Ermolovich
560a1cb16f Use proc to set password length validation so it's possible to override it dynamically.
Co-authored-by: Manoj M J <manojmj92@gmail.com>
2024-11-29 14:10:07 +01:00
Vasiliy Ermolovich
dce20b78f5 Merge pull request #5732 from heartcombo/fix-format
Fix passing of format option to devise_for call.
2024-11-25 14:47:44 +00:00
Vasiliy Ermolovich
46c2c3913e Fix passing of format option to devise_for call. 2024-11-25 15:40:37 +01:00
Vasiliy Ermolovich
7eccc91f61 Merge pull request #5731 from heartcombo/fix-without-mailer-load
Fix Zeitwerk autoloading when ActionMailer is not present.
2024-11-25 12:57:51 +00:00
Vasiliy Ermolovich
af112a2f65 Fix Zeitwerk autoloading when ActionMailer is not present.
When ActionMailer is not defined we have empty app/mailers/devise/mailer.rb file and Zeitwerk doesn't
like that and errors with

```
expected file app/mailers/devise/mailer.rb to define constant Devise::Mailer
```

The fix is to tell Zeitwerk to ignore that file if ActionMailer constant if not defined.

I tried to write a spec for it but since specs are run in the same process it's hard to have two
Rails applications where one of them has ActionMailer define and the seconds one doesn't.
2024-11-25 13:57:07 +01:00
Vasiliy Ermolovich
90a3fa8599 Merge pull request #5730 from jeromedalbert/fix-ci
Fix Rails main CI
2024-11-25 07:37:25 +00:00
Jerome Dalbert
950721d6de Fix Rails 8 CI 2024-11-24 18:28:09 -08:00
Vasiliy Ermolovich
591b03a6c0 Merge pull request #5728 from heartcombo/lazy-routes-fix
Make Devise.mappings work with lazy loaded routes.
2024-11-24 15:27:27 +00:00
Vasiliy Ermolovich
24c47140e5 Make Devise.mappings work with lazy loaded routes.
Starting from Rails 8.0, routes are lazy-loaded by default in test and development environments.
However, Devise's mappings are built during the routes loading phase.
To ensure it works correctly, we need to load the routes first before accessing @@mappings.
2024-11-24 16:20:26 +01:00
Vasiliy Ermolovich
0f514f1413 Merge pull request #5514 from itay-grudev/master
Bug Fix: Devise Checkbox TRUE VALUES not compatible with HTML specs (missing "on" value)
2024-11-08 16:40:12 +00:00
Itay Grudev
12f0dd1608 Bug Fix: Devise Checkbox TRUE VALUES not compatible with HTML specs (missing "on" value)
See:
* https://html.spec.whatwg.org/multipage/input.html#checkbox-state-(type%3Dcheckbox)
* https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on

This issue causes the remember me functionality not to work correctly, especially when overriding the default styles as check boxes by default in all major browsers send the value `on` as required by the HTML specifications.

See also:

https://stackoverflow.com/questions/5987075/devise-remember-me-not-working-localhost-issue
2024-11-08 18:13:05 +02:00
Vasiliy Ermolovich
12c796e499 Merge pull request #5719 from kazuyainoue0124/fix_typos_in_readme
Remove unnecessary closing parenthesis in README [ci skip]
2024-10-22 18:49:08 +00:00
Vasiliy Ermolovich
baf0d8eff2 Update CHANGELOG.md 2024-10-22 20:45:41 +02:00
Vasiliy Ermolovich
5b15bbee7a Merge pull request #5645 from BroiSatse/main
Removed now obsolete SecretKeyFinder
2024-10-22 18:33:18 +00:00
Kazuya INOUE
25f806e270 Remove unnecessary closing parenthesis in README 2024-10-06 23:14:48 +09:00
Vasiliy Ermolovich
72884642f5 Merge pull request #5706 from abr-storm/main
Rails 8: Update route registration to use keyword arguments
2024-08-18 09:20:19 +00:00
Alex Brook
54e4b267a5 splat keyword arguments when registering routes 2024-08-17 17:34:36 +01:00
Vasiliy Ermolovich
0a2505ee23 Merge pull request #5708 from jeromedalbert/fix-ci-rails-main
Rails 8: Fix CI sqlite3 error for Gemfile-rails-main
2024-08-17 09:58:10 +00:00
Jerome Dalbert
1d859b5db0 Fix CI sqlite3 error for Gemfile-rails-main 2024-08-17 01:25:06 -07:00
Carlos Antonio da Silva
a259ff3c28 Make it clearer that we're targeting a v5 going forward
Use a "beta" version to make that even more explicit.
2024-04-10 09:45:08 -03:00
Carlos Antonio da Silva
9a7176f727 Cleanup changelog, point to 4-stable branch for previous changes
main is targetting a v5 with some possible breaking changes, for main
it's mainly dropping support for older Ruby/Rails versions, but more
might come.

[ci skip]
2024-04-10 09:43:27 -03:00
Carlos Antonio da Silva
21deb5c145 Bump year [ci skip] 2024-04-09 16:58:24 -03:00
Carlos Antonio da Silva
6ee12d1521 Merge pull request #5668 from berkos/update-ci
Adds Ruby 3.3 to CI
2024-04-09 14:20:06 -03:00
Antonis Berkakis
c80026d955 Update CI to run to include Ruby 3.3
- Exclude Rubies >=3.1 from latest main Gemfile as it runs on 7.2
2024-04-09 14:56:07 +01:00
Artin Boghosian
bb18f4d380 Update mapping.rb (#5673)
Fix grammar on comment for .find_scope! [ci skip]
2024-02-13 09:22:46 -03:00
Stanislaw Klajn
b6d64ba525 Removed now obsolete SecretKeyFinder 2023-10-26 10:41:52 +01:00
Carlos Antonio da Silva
e2242a95f3 Merge pull request #5641 from henryaj/patch-1
Fix README anchor link
2023-10-13 11:56:48 -03:00
Henry Stanley
c4578d3240 Fix README anchor link
Fixes link to Active Job Integration in README.
2023-10-13 15:54:36 +01:00
Carlos Antonio da Silva
5667ceaa1e Merge pull request #5600 from heartcombo/rm-drop-support-to-old-rubies-and-rails
Drop support to EOL rubies and Rails
2023-10-13 11:23:18 -03:00
Carlos Antonio da Silva
4d18d81311 Respect locale set by controller in the failure app (#5567)
A common usage of I18n with different locales is to create some around
callback in the application controller that sets the locale for the
entire action, via params/url/user/etc., which ensure the locale is
respected for the duration of that action, and resets at the end.

Devise was not respecting the locale when the authenticate failed and
triggered the failure app, because that happens in a warden middleware
right up in the change, by that time the controller around callback had
already reset the locale back to its default, and the failure app would
just translate flash messages using the default locale.

Now we are passing the current locale down to the failure app via warden
options, and wrapping it with an around callback, which makes the
failure app respect the set I18n locale by the controller at the time
the authentication failure is triggered, working as expected. (much more
like a normal controller would.)

I chose to introduce a callback in the failure app so we could wrap the
whole `respond` action processing rather than adding individual `locale`
options to the `I18n.t` calls, because that should ensure other possible
`I18n.t` calls from overridden failure apps would respect the set locale
as well, and makes it more like one would implement in a controller. I
don't recommend people using callbacks in their own failure apps though,
as this is not going to be documented as a "feature" of failures apps,
it's considered "internal" and could be refactored at any point.

It is possible to override the locale with the new `i18n_locale` method,
which simply defaults to the passed locale from the controller.

Closes #5247
Closes #5246

Related to: #3052, #4823, and possible others already closed.
Related to warden: (may be closed there afterwards)
https://github.com/wardencommunity/warden/issues/180
https://github.com/wardencommunity/warden/issues/170
2023-10-13 11:20:29 -03:00
Carlos Antonio da Silva
63939c121e Remove deprecated options argument from update methods
They were added to support an old/deprecated feature of Rails, as the
message was saying, we can now remove them from the code as well.
2023-10-13 11:02:45 -03:00
Carlos Antonio da Silva
49e4a991cf Remove some more code added to support older versions
Also change back to run CI on ubuntu-latest which should work with all
Ruby versions supported now.
2023-10-13 11:02:45 -03:00
Carlos Antonio da Silva
72b421e571 Update gemfile readme references 2023-10-13 10:44:06 -03:00
Carlos Antonio da Silva
23633b70f0 Bring back Ruby 2.7 support
It's EOL but the current versions of Rails are still supporting it, so
it makes sense for us to keep supporting it as well. And it doesn't give
us any extra maintenance burden as older versions have been doing.
2023-10-13 10:44:05 -03:00