Compare commits

...

7 Commits

Author SHA1 Message Date
Leonardo Tegon
e55c9caa05 Prepare for 4.4.1 release 2018-01-23 15:03:41 -02:00
Leonardo Tegon
0f8695dd4b Update CHANGELOG.md [ci skip] 2018-01-23 13:31:26 -02:00
Alex Matchneer
d9deeba582 Fix signed_in? docs w.r.t. running auth hooks (#4733)
Addresses #4599

The docs previously mentioned that authentication hooks are not run when `signed_in?` is called, when in fact they are. This commit fixes the comment and suggests calling `authenticated?` on warden directly as an alternative for when you _don't_ want to run auth hooks.
2018-01-23 13:18:37 -02:00
Leonardo Tegon
d1948b79d3 Fix ActiveRecord check on Confirmable (#4752)
* Fix `ActiveRecord` check on `Confirmable`

As pointed out by @dark-panda in #4302, the condition for an
`ActiveRecord` model is wrong inside the `Confirmable` initialization
block.

https://github.com/plataformatec/devise/pull/4302#issuecomment-355103489

* Add specs
2018-01-16 10:25:20 -02:00
Rafael França
371d657e35 Merge pull request #4753 from segiddins/patch-1
[Gemspec] Ensure it is loaded as utf-8
2018-01-15 15:03:03 -05:00
Samuel Giddins
82087ce211 [Gemspec] Ensure it is loaded as utf-8 2018-01-12 21:26:42 -08:00
Leonardo Tegon
463351922f Update copyright [ci skip] 2018-01-03 21:20:13 -02:00
11 changed files with 34 additions and 13 deletions

View File

@@ -1,5 +1,12 @@
### Unreleased
### 4.4.1 - 2018-01-23
* bug fixes
* Ensure Gemspec is loaded as utf-8. (by @segiddins)
* Fix `ActiveRecord` check on `Confirmable`. (by @tegon)
* Fix `signed_in?` docs without running auth hooks. by (@machty)
### 4.4.0 - 2017-12-29
* enhancements

View File

@@ -10,7 +10,7 @@ GIT
PATH
remote: .
specs:
devise (4.4.0)
devise (4.4.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.2)
@@ -190,4 +190,4 @@ DEPENDENCIES
webrat (= 0.7.3)
BUNDLED WITH
1.15.3
1.16.0

View File

@@ -674,6 +674,6 @@ https://github.com/plataformatec/devise/graphs/contributors
## License
MIT License. Copyright 2009-2017 Plataformatec. http://plataformatec.com.br
MIT License. Copyright 2009-2018 Plataformatec. http://plataformatec.com.br
You are not granted rights or licenses to the trademarks of Plataformatec, including without limitation the Devise name or logo.

View File

@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
# frozen_string_literal: true
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "devise/version"

View File

@@ -21,7 +21,7 @@ GIT
PATH
remote: ..
specs:
devise (4.4.0)
devise (4.4.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.2)
@@ -168,4 +168,4 @@ DEPENDENCIES
webrat (= 0.7.3)
BUNDLED WITH
1.15.3
1.16.0

View File

@@ -57,7 +57,7 @@ GIT
PATH
remote: ..
specs:
devise (4.4.0)
devise (4.4.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.2)
@@ -189,4 +189,4 @@ DEPENDENCIES
webrat (= 0.7.3)
BUNDLED WITH
1.15.3
1.16.0

View File

@@ -10,7 +10,7 @@ GIT
PATH
remote: ..
specs:
devise (4.4.0)
devise (4.4.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.2)
@@ -189,4 +189,4 @@ DEPENDENCIES
webrat (= 0.7.3)
BUNDLED WITH
1.15.3
1.16.0

View File

@@ -6,7 +6,10 @@ module Devise
# Included by default in all controllers.
module SignInOut
# Return true if the given scope is signed in session. If no scope given, return
# true if any scope is signed in. Does not run authentication hooks.
# true if any scope is signed in. This will run authentication hooks, which may
# cause exceptions to be thrown from this method; if you simply want to check
# if a scope has already previously been authenticated without running
# authentication hooks, you can directly call `warden.authenticated?(scope: scope)`
def signed_in?(scope=nil)
[scope || Devise.mappings.keys].flatten.any? do |_scope|
warden.authenticate?(scope: _scope)

View File

@@ -48,7 +48,7 @@ module Devise
included do
before_create :generate_confirmation_token, if: :confirmation_required?
after_create :skip_reconfirmation_in_callback!, if: :send_confirmation_notification?
if defined?(ActiveRecord) && self.is_a?(ActiveRecord::Base) # ActiveRecord
if defined?(ActiveRecord) && self < ActiveRecord::Base # ActiveRecord
after_commit :send_on_create_confirmation_instructions, on: :create, if: :send_confirmation_notification?
after_commit :send_reconfirmation_instructions, on: :update, if: :reconfirmation_required?
else # Mongoid

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Devise
VERSION = "4.4.0".freeze
VERSION = "4.4.1".freeze
end

View File

@@ -8,6 +8,17 @@ class ConfirmableTest < ActiveSupport::TestCase
setup_mailer
end
test 'should set callbacks to send the mail' do
if DEVISE_ORM == :active_record
defined_callbacks = User._commit_callbacks.map(&:filter)
assert_includes defined_callbacks, :send_on_create_confirmation_instructions
assert_includes defined_callbacks, :send_reconfirmation_instructions
elsif DEVISE_ORM == :mongoid
assert_includes User._create_callbacks.map(&:filter), :send_on_create_confirmation_instructions
assert_includes User._update_callbacks.map(&:filter), :send_reconfirmation_instructions
end
end
test 'should generate confirmation token after creating a record' do
assert_nil new_user.confirmation_token
assert_not_nil create_user.confirmation_token