mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 23:58:06 -05:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4da955d9cd | ||
|
|
bff701758a | ||
|
|
90acc6fc23 | ||
|
|
48220f087b | ||
|
|
26b17abb01 | ||
|
|
22468f3756 | ||
|
|
9696d83e7d | ||
|
|
7d10019d2a | ||
|
|
274f8f2f87 | ||
|
|
3360b10c2f | ||
|
|
6f9561e64f | ||
|
|
016b216d95 |
@@ -1,5 +1,13 @@
|
||||
### Unreleased
|
||||
|
||||
### 4.0.1 - 2016-04-25
|
||||
|
||||
* bug fixes
|
||||
* Fix the e-mail confirmation instructions send when a user updates the email
|
||||
address from nil. (by @lmduc)
|
||||
* Remove unnecessary `attribute_will_change!` call. (by @cadejscroggins)
|
||||
* Consistent `permit!` check. (by @ulissesalmeida)
|
||||
|
||||
### 4.0.0 - 2016-04-18
|
||||
|
||||
* bug fixes
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -25,5 +25,5 @@ platforms :ruby do
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 4.0"
|
||||
gem "mongoid", "~> 5.0"
|
||||
end
|
||||
|
||||
18
Gemfile.lock
18
Gemfile.lock
@@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
devise (4.0.0)
|
||||
devise (4.0.1)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0, < 5.1)
|
||||
@@ -48,10 +48,9 @@ GEM
|
||||
tzinfo (~> 1.1)
|
||||
arel (6.0.3)
|
||||
bcrypt (3.1.11)
|
||||
bson (3.2.6)
|
||||
bson (4.0.0)
|
||||
builder (3.2.2)
|
||||
concurrent-ruby (1.0.1)
|
||||
connection_pool (2.2.0)
|
||||
erubis (2.7.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
@@ -71,15 +70,13 @@ GEM
|
||||
minitest (5.8.4)
|
||||
mocha (1.1.0)
|
||||
metaclass (~> 0.0.1)
|
||||
mongoid (4.0.2)
|
||||
mongo (2.2.0)
|
||||
bson (~> 4.0)
|
||||
mongoid (5.0.1)
|
||||
activemodel (~> 4.0)
|
||||
moped (~> 2.0.0)
|
||||
mongo (~> 2.1)
|
||||
origin (~> 2.1)
|
||||
tzinfo (>= 0.3.37)
|
||||
moped (2.0.7)
|
||||
bson (~> 3.0)
|
||||
connection_pool (~> 2.0)
|
||||
optionable (~> 0.2.0)
|
||||
multi_json (1.11.2)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
@@ -102,7 +99,6 @@ GEM
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
optionable (0.2.0)
|
||||
origin (2.2.0)
|
||||
orm_adapter (0.5.0)
|
||||
rack (1.6.4)
|
||||
@@ -169,7 +165,7 @@ DEPENDENCIES
|
||||
devise!
|
||||
jruby-openssl
|
||||
mocha (~> 1.1)
|
||||
mongoid (~> 4.0)
|
||||
mongoid (~> 5.0)
|
||||
omniauth (~> 1.3)
|
||||
omniauth-facebook
|
||||
omniauth-oauth2 (~> 1.4)
|
||||
|
||||
@@ -253,7 +253,7 @@ module Devise
|
||||
|
||||
# Find or initialize a record with group of attributes based on a list of required attributes.
|
||||
def find_or_initialize_with_errors(required_attributes, attributes, error=:invalid) #:nodoc:
|
||||
attributes = if attributes.respond_to? :permit
|
||||
attributes = if attributes.respond_to? :permit!
|
||||
attributes.slice(*required_attributes).permit!.to_h.with_indifferent_access
|
||||
else
|
||||
attributes.with_indifferent_access.slice(*required_attributes)
|
||||
|
||||
@@ -169,6 +169,7 @@ module Devise
|
||||
# in models to map to a nice sign up e-mail.
|
||||
def send_on_create_confirmation_instructions
|
||||
send_confirmation_instructions
|
||||
skip_reconfirmation!
|
||||
end
|
||||
|
||||
# Callback to overwrite if confirmation is required or not.
|
||||
@@ -253,13 +254,13 @@ module Devise
|
||||
end
|
||||
|
||||
def postpone_email_change?
|
||||
postpone = self.class.reconfirmable && email_changed? && email_was.present? && !@bypass_confirmation_postpone && self.email.present?
|
||||
postpone = self.class.reconfirmable && email_changed? && !@bypass_confirmation_postpone && self.email.present?
|
||||
@bypass_confirmation_postpone = false
|
||||
postpone
|
||||
end
|
||||
|
||||
def reconfirmation_required?
|
||||
self.class.reconfirmable && @reconfirmation_required && self.email.present?
|
||||
self.class.reconfirmable && @reconfirmation_required && (self.email.present? || self.unconfirmed_email.present?)
|
||||
end
|
||||
|
||||
def send_confirmation_notification?
|
||||
|
||||
@@ -41,7 +41,6 @@ module Devise
|
||||
# For legacy reasons, we use `encrypted_password` to store
|
||||
# the hashed password.
|
||||
def password=(new_password)
|
||||
attribute_will_change! 'password'
|
||||
@password = new_password
|
||||
self.encrypted_password = password_digest(@password) if @password.present?
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Devise
|
||||
VERSION = "4.0.0".freeze
|
||||
VERSION = "4.0.1".freeze
|
||||
end
|
||||
|
||||
@@ -114,7 +114,7 @@ class ConfirmableTest < ActiveSupport::TestCase
|
||||
|
||||
assert_email_not_sent do
|
||||
user.save!
|
||||
assert !user.confirmed?
|
||||
assert_not user.confirmed?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -401,6 +401,14 @@ class ReconfirmableTest < ActiveSupport::TestCase
|
||||
assert_match "new_test@example.com", ActionMailer::Base.deliveries.last.body.encoded
|
||||
end
|
||||
|
||||
test 'should send confirmation instructions by email after changing email from nil' do
|
||||
admin = create_admin(email: nil)
|
||||
assert_email_sent "new_test@example.com" do
|
||||
assert admin.update_attributes(email: 'new_test@example.com')
|
||||
end
|
||||
assert_match "new_test@example.com", ActionMailer::Base.deliveries.last.body.encoded
|
||||
end
|
||||
|
||||
test 'should not send confirmation by email after changing password' do
|
||||
admin = create_admin
|
||||
assert admin.confirm
|
||||
@@ -488,8 +496,8 @@ class ReconfirmableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'should not require reconfirmation after creating a record' do
|
||||
user = create_admin
|
||||
assert !user.pending_reconfirmation?
|
||||
admin = create_admin
|
||||
assert !admin.pending_reconfirmation?
|
||||
end
|
||||
|
||||
test 'should not require reconfirmation after creating a record with #save called in callback' do
|
||||
@@ -497,7 +505,7 @@ class ReconfirmableTest < ActiveSupport::TestCase
|
||||
after_create :save
|
||||
end
|
||||
|
||||
user = Admin::WithSaveInCallback.create(valid_attributes.except(:username))
|
||||
assert !user.pending_reconfirmation?
|
||||
admin = Admin::WithSaveInCallback.create(valid_attributes.except(:username))
|
||||
assert !admin.pending_reconfirmation?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
test:
|
||||
sessions:
|
||||
<%= Mongoid::VERSION.to_i > 4 ? 'clients' : 'sessions' %>:
|
||||
default:
|
||||
database: devise-test-suite
|
||||
hosts:
|
||||
|
||||
Reference in New Issue
Block a user