57 Commits

Author SHA1 Message Date
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
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
fb7faf7466 Fix code to support older versions of Ruby
We still support super old versions, yes, and it doesn't like `ensure`
without a `begin..end` unfortunately.

I plan to remove this support soon, but for now I don't want to stop
supporting it yet.
2023-10-10 11:29:29 -03:00
Rafael Mendonça França
a7d64ae313 Merge pull request #5583 from etiennebarrie/deprecator
Use a dedicated ActiveSupport::Deprecation
2023-10-10 11:29:29 -03:00
Carlos Antonio da Silva
94be5fb6a1 Remove mocha deprecation warning
Mocha deprecation warning at
    ...../active_support/dependencies.rb:324:in `require':
    Require 'mocha/test_unit', 'mocha/minitest' or 'mocha/api'
    instead of 'mocha/setup'.
2020-06-07 19:49:51 -03: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
Pat Allan
f39c6fd927 Add the frozen_string_literal pragma comment to all Ruby files. (#4725) 2017-12-21 15:36:29 -02:00
Lucas Mazza
ee69d41fc1 Remove ActiveSupport test order deprecation warning 2014-09-29 17:42:08 -03:00
Chun-Yang
992ee86b41 add test for controllers generator 2014-08-24 22:05:54 -05:00
Lucas Mazza
fa36464268 Silence the OmniAuth logger during tests. 2014-05-14 23:25:29 -03:00
José Valim
221be6d6ef Update bundled rails app 2013-11-13 13:29:25 +01:00
Carlos Antonio da Silva
69f79ad446 Let Devise play with both Rails 3.2 and Rails 4 for now 2013-05-05 19:55:06 -03:00
Carlos Antonio da Silva
f8792c8cf0 Update to Rails 3-2-stable and fix failing tests 2013-02-25 22:06:10 -03:00
José Valim
6250fa8529 Revert "Merge pull request #1103 from Mab879/master"
This reverts commit 944e1c0378, reversing
changes made to 97659a1193.
2011-06-08 17:37:49 +02:00
Matthew Burket
4f446241a4 Added Controller Generator and tests to go along with it. 2011-05-30 23:07:20 -05:00
Vinicius Baggio
352edc024b Cleaning up test helpers related to OmniAuth.
Developers should rely on OmniAuth's new testing API. Check
https://github.com/intridea/omniauth/wiki/Integration-Testing
for more details.
2011-02-24 16:50:22 -03:00
José Valim
b942520dc4 No need to use expand_path as we assume the test directory is in the . 2010-12-18 08:22:01 +01:00
Carlos Antonio da Silva
eb7760b4b2 Make sure to load test gems only in Devise test env 2010-11-26 00:55:16 -02:00
José Valim
611261c64e More tests for Omniauth. 2010-10-18 15:00:34 +02:00
José Valim
ef841ca17d Start to add helpers for OAuth tests. 2010-07-26 20:33:22 +02:00
José Valim
bd8294aecf More OAuth setup. 2010-07-26 20:32:04 +02:00
José Valim
41311eb38d Move mailer configuration to the app. 2010-04-25 09:26:51 +02:00
José Valim
ea71be8d2a More compatibility with Rails master. 2010-03-28 07:15:52 +02:00
José Valim
b4bbd3b892 Get all tests passing for ActiveRecord and allow MongoMapper tests to run. 2010-02-17 10:11:43 +01:00
José Valim
b3e11c5aca Got another bunch of tests passing on Rails 3. 369 tests, 731 assertions, 33 failures, 53 errors. 2010-02-16 14:57:10 +01:00
José Valim
766316b5e7 Got tests running on Rails 3: 369 tests, 486 assertions, 45 failures, 124 errors. 2010-02-16 14:31:49 +01:00
José Valim
35a8d13369 Tests passing for ActiveRecord and MongoMapper. 2009-12-21 21:10:23 +01:00
José Valim
0819f87255 Test different ORMs 2009-12-21 15:29:58 +01:00
José Valim
f9c5dd6a79 Added trackable for sign_in_count, sign_in_at and sign_in_ip. 2009-11-24 15:18:42 -02:00
José Valim
6c3bebe630 Make mocha dependency explicit. 2009-11-24 12:54:18 -02:00
Carlos Antonio da Silva
099c77e867 Introducing timeoutable to timeout sessions without activity. 2009-11-23 23:01:00 -02:00
Carlos Antonio da Silva
6829619330 Allow overwriting find for authentication method. 2009-11-19 13:53:57 -02:00
José Valim
b70b293690 Add authentication_keys. 2009-11-15 03:31:13 -02:00
José Valim
b28d7e8b1c Renamed authenticable to authenticatable and added deprecation warnings. 2009-10-30 08:29:10 -02:00
José Valim
5172d50b95 Ensure fail! works inside strategies, create unauthenticated and invalid messages and do not redirect on invalid authentication. 2009-10-29 08:29:31 -02:00
José Valim
200b269d79 Allow null to be given to authenticable. 2009-10-22 19:26:10 -02:00
José Valim
f00d29c97a Devise migratable. 2009-10-21 00:09:26 -02:00
Carlos A. da Silva
28a7f78fba Creating rememberable module. 2009-10-20 00:31:33 -02:00
Carlos A. da Silva
75e98d3041 Separating perishable token into confirmation and reset_password tokens. Adding confirmation_sent_at attribute. 2009-10-18 09:14:52 -02:00
Carlos A. da Silva
1226c3d8de Adding separated tests for admins and users to enforce modularization. Rewrite of several tests. 2009-10-11 10:49:25 -03:00
Carlos A. da Silva
198167d978 Removing default mapping and Updating tests at all 2009-10-10 18:07:25 -03:00
Carlos A. da Silva
23bb351d0e Tests with resource and resource_class 2009-10-10 09:32:51 -03:00
Carlos A. da Silva
f4de0f6c5a Creating Devise.map to generate and recognize urls based on scope. 2009-10-09 21:11:58 -03:00
Carlos A. da Silva
1e2ffc4104 Routes using i18n and tests, moving test helpers to support directory. 2009-10-09 07:36:13 -03:00
Carlos A. da Silva
1bd14eadfa Creating notification tests and views. 2009-10-09 07:36:13 -03:00
Carlos A. da Silva
3b5f1437b5 Creating helpers module and link helpers. 2009-10-09 07:36:13 -03:00
Carlos A. da Silva
7ce49cbbe8 Configuring session and password controllers as engine, and getting integration tests from devise example app. 2009-10-09 07:36:12 -03:00
Carlos A. da Silva
b82717a96c Adding validatable module containing some default email and password validations. 2009-09-18 12:03:41 -03:00
Carlos A. da Silva
7f77b4ae40 Creating recoverable module, reseting passwords and sending reset instructions. Some minor refactorings. 2009-09-18 10:20:45 -03:00