Compare commits

...

18 Commits

Author SHA1 Message Date
José Valim
6c2f51e35e Release 2.2.2 2013-01-15 21:03:15 +01:00
Lucas Mazza
47db984f52 Apply the changes on 0c4615e33 to the simple_form template too. 2013-01-14 18:53:34 -02:00
José Valim
0c4615e337 Properly check if reconfirmable is available 2013-01-13 09:53:26 +01:00
Carlos Antonio da Silva
85e46f0163 Merge pull request #2211 from nashby/fix-build
uUe click_button for canceling account in integration specs
2013-01-12 03:16:12 -08:00
Vasiliy Ermolovich
9913fde749 use click_button for canceling account in integration specs 2013-01-12 14:12:05 +03:00
José Valim
1f940f61c6 Merge pull request #2210 from steverob/master
Changed link_to to button_to for cancel registration link in edit registration view
2013-01-11 14:25:55 -08:00
Steve Robinson
70e38fe66d Changed link_to to button_to for delete user
It is advisable to use link_to for mostly GET operations. Actions like DESTROY when presented as a link can cause severe vulnerabilities.
Hence using a button is advisable.
2013-01-12 01:53:09 +05:30
José Valim
872ef2b97f Release 2.2.1 with fixes for 2.2.0 regressions 2013-01-11 19:15:54 +01:00
José Valim
33fb89340a Revert "update_with_password doesn't change encrypted password when it is invalid"
This reverts commit 10235f9d72.
2013-01-11 19:12:53 +01:00
José Valim
bd9bf326c0 Merge pull request #2206 from tigris/mailer_subject_rename
Rename Devise::Mailer.translate() to something more inline with what it does
2013-01-10 04:19:57 -08:00
Danial Pearce
d48414b0a5 Rename Devise::Mailer.translate() to something more inline with what it does. 2013-01-10 15:26:06 +11:00
José Valim
b6a7d11e5a Merge pull request #2205 from latortuga/2204-regression-with-db-authenticatable
2204 regression with db authenticatable
2013-01-09 09:52:14 -08:00
Drew Ulmer
75ce916be9 Call respond_to?(attr) before applying strip or downcase
This avoids calling strip and downcase on globally configured keys that may
not exist on all devise models. Fixes #2204, a regression introduced by
PR #2135. Also included a note about the intentional use of respond_to.
2013-01-09 11:42:54 -06:00
Drew Ulmer
c768366240 Add failing tests for Issue #2204
For a point release upgrade, Devise should not throw an exception when trying
to downcase or strip globally configured keys. This would be a breaking
change in functionality and this test demonstrates the issue.
2013-01-09 11:41:20 -06:00
Lucas Mazza
ca7d479e90 Install mongoid only on 1.9 2013-01-09 11:51:15 -02:00
Rafael Mendonça França
5bfbc264b7 Invalid YAML 💣 2013-01-09 10:14:01 -02:00
Rafael Mendonça França
9f8d3db2b4 Notify on campfire 2013-01-09 10:11:24 -02:00
Lucas Mazza
4b0d161f95 Update Gemfile.locks to latest patch releases of Rails and fix mocha to 0.10.0.t 2013-01-09 10:01:25 -02:00
14 changed files with 149 additions and 116 deletions

View File

@@ -34,8 +34,9 @@ gemfile:
services:
- mongodb
notifications:
recipients:
- jose.valim@plataformatec.com.br
- carlos@plataformatec.com.br
- rodrigo.flores@plataformatec.com.br
- rafael.franca@plataformatec.com.br
email: false
campfire:
on_success: change
on_failure: always
rooms:
- secure: "TRiqvuM4i/QmRDWjUSNitE5/P91BOzDkNl53+bZjjtxcISCswZtmECWBR7n9\n3xwqCOU1o2lfohxZ32OHOj/Nj7o+90zWJfWxcv+if0hIXRiil62M5pg0lZUd\nyJ4M5VQ0lSWo5he1OUrXhSabPJeaK3B8yT/tdh+qO5yzR+vb/jc="

View File

@@ -1,3 +1,14 @@
== 2.2.2
* bug fix
* Fix bug when checking for reconfirmable in templates
== 2.2.1
* bug fix
* Fix regression with case_insensitive_keys
* Fix regression when password is blank when it is invalid
== 2.2.0
* backwards incompatible changes

View File

@@ -22,8 +22,11 @@ end
platforms :ruby do
gem "sqlite3"
end
platforms :mri_19 do
group :mongoid do
gem "mongoid", "~> 3.0"
end
end
end

View File

@@ -1,7 +1,7 @@
PATH
remote: .
specs:
devise (2.2.0.rc)
devise (2.2.1)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (~> 3.1)
@@ -10,12 +10,12 @@ PATH
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.9)
actionpack (= 3.2.9)
actionmailer (3.2.11)
actionpack (= 3.2.11)
mail (~> 2.4.4)
actionpack (3.2.9)
activemodel (= 3.2.9)
activesupport (= 3.2.9)
actionpack (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@@ -23,18 +23,18 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.9)
activesupport (= 3.2.9)
activemodel (3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
activerecord (3.2.9)
activemodel (= 3.2.9)
activesupport (= 3.2.9)
activerecord (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.9)
activemodel (= 3.2.9)
activesupport (= 3.2.9)
activesupport (3.2.9)
activeresource (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
activesupport (3.2.11)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
@@ -48,7 +48,7 @@ GEM
httpauth (0.2.0)
i18n (0.6.1)
journey (1.0.4)
json (1.7.5)
json (1.7.6)
jwt (0.1.5)
multi_json (>= 1.0)
mail (2.4.4)
@@ -59,13 +59,13 @@ GEM
mime-types (1.19)
mocha (0.10.0)
metaclass (~> 0.0.1)
mongoid (3.0.14)
mongoid (3.0.16)
activemodel (~> 3.1)
moped (~> 1.1)
origin (~> 1.0)
tzinfo (~> 0.3.22)
moped (1.3.1)
multi_json (1.4.0)
moped (1.3.2)
multi_json (1.5.0)
multipart-post (1.1.5)
nokogiri (1.5.5)
oauth2 (0.8.0)
@@ -88,7 +88,7 @@ GEM
origin (1.0.11)
orm_adapter (0.4.0)
polyglot (0.3.3)
rack (1.4.1)
rack (1.4.3)
rack-cache (1.2)
rack (>= 0.4)
rack-openid (1.3.1)
@@ -98,22 +98,22 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.9)
actionmailer (= 3.2.9)
actionpack (= 3.2.9)
activerecord (= 3.2.9)
activeresource (= 3.2.9)
activesupport (= 3.2.9)
rails (3.2.11)
actionmailer (= 3.2.11)
actionpack (= 3.2.11)
activerecord (= 3.2.11)
activeresource (= 3.2.11)
activesupport (= 3.2.11)
bundler (~> 1.0)
railties (= 3.2.9)
railties (3.2.9)
actionpack (= 3.2.9)
activesupport (= 3.2.9)
railties (= 3.2.11)
railties (3.2.11)
actionpack (= 3.2.11)
activesupport (= 3.2.11)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.2)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
ruby-openid (2.2.2)

View File

@@ -6,7 +6,7 @@
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<% if resource.class.reconfirmable && resource.unconfirmed_email.present? %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
@@ -24,6 +24,6 @@
<h3>Cancel my account</h3>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p>
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p>
<%= link_to "Back", :back %>

View File

@@ -11,7 +11,7 @@ group :test do
gem "omniauth-facebook"
gem "omniauth-openid", "~> 1.0.1"
gem "webrat", "0.7.2", :require => false
gem "mocha", :require => false
gem "mocha", "0.10.0", :require => false
platforms :mri_18 do
gem "ruby-debug", ">= 0.10.3"
@@ -26,8 +26,10 @@ end
platforms :ruby do
gem "sqlite3"
end
platforms :mri_19 do
group :mongoid do
gem "mongoid", "~> 3.0"
end
end
end

View File

@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
devise (2.1.2)
devise (2.2.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (~> 3.1)
@@ -10,48 +10,48 @@ PATH
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.4)
actionpack (= 3.1.4)
mail (~> 2.3.0)
actionpack (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
actionmailer (3.1.10)
actionpack (= 3.1.10)
mail (~> 2.3.3)
actionpack (3.1.10)
activemodel (= 3.1.10)
activesupport (= 3.1.10)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.6)
rack-cache (~> 1.1)
rack-cache (~> 1.2)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.3)
activemodel (3.1.4)
activesupport (= 3.1.4)
sprockets (~> 2.0.4)
activemodel (3.1.10)
activesupport (= 3.1.10)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
activerecord (3.1.10)
activemodel (= 3.1.10)
activesupport (= 3.1.10)
arel (~> 2.2.3)
tzinfo (~> 0.3.29)
activeresource (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
activesupport (3.1.4)
multi_json (~> 1.0)
addressable (2.2.7)
activeresource (3.1.10)
activemodel (= 3.1.10)
activesupport (= 3.1.10)
activesupport (3.1.10)
multi_json (>= 1.0, < 1.3)
arel (2.2.3)
bcrypt-ruby (3.0.1)
builder (3.0.0)
builder (3.0.4)
columnize (0.3.6)
erubis (2.7.0)
faraday (0.7.6)
addressable (~> 2.2)
faraday (0.8.4)
multipart-post (~> 1.1)
rack (~> 1.1)
hashie (1.2.0)
hike (1.2.1)
i18n (0.6.0)
json (1.7.0)
httpauth (0.2.0)
i18n (0.6.1)
json (1.7.6)
jwt (0.1.5)
multi_json (>= 1.0)
linecache (0.46)
rbx-require-relative (> 0.0.4)
mail (2.3.3)
@@ -59,36 +59,39 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
mime-types (1.18)
mocha (0.10.4)
mime-types (1.19)
mocha (0.10.0)
metaclass (~> 0.0.1)
mongoid (3.0.12)
mongoid (3.0.16)
activemodel (~> 3.1)
moped (~> 1.1)
origin (~> 1.0)
tzinfo (~> 0.3.22)
moped (1.2.9)
multi_json (1.3.4)
moped (1.3.2)
multi_json (1.2.0)
multipart-post (1.1.5)
nokogiri (1.5.0)
oauth2 (0.5.2)
faraday (~> 0.7)
nokogiri (1.5.6)
oauth2 (0.8.0)
faraday (~> 0.8)
httpauth (~> 0.1)
jwt (~> 0.1.4)
multi_json (~> 1.0)
omniauth (1.0.2)
rack (~> 1.2)
omniauth (1.0.3)
hashie (~> 1.2)
rack
omniauth-facebook (1.2.0)
omniauth-oauth2 (~> 1.0.0)
omniauth-oauth2 (1.0.0)
oauth2 (~> 0.5.0)
omniauth-facebook (1.4.0)
omniauth-oauth2 (~> 1.0.2)
omniauth-oauth2 (1.0.3)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
omniauth-openid (1.0.1)
omniauth (~> 1.0)
rack-openid (~> 1.3.1)
origin (1.0.10)
origin (1.0.11)
orm_adapter (0.4.0)
polyglot (0.3.3)
rack (1.3.6)
rack (1.3.8)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
@@ -98,25 +101,25 @@ GEM
ruby-openid (>= 2.1.8)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack-test (0.6.2)
rack (>= 1.0)
rails (3.1.4)
actionmailer (= 3.1.4)
actionpack (= 3.1.4)
activerecord (= 3.1.4)
activeresource (= 3.1.4)
activesupport (= 3.1.4)
rails (3.1.10)
actionmailer (= 3.1.10)
actionpack (= 3.1.10)
activerecord (= 3.1.10)
activeresource (= 3.1.10)
activesupport (= 3.1.10)
bundler (~> 1.0)
railties (= 3.1.4)
railties (3.1.4)
actionpack (= 3.1.4)
activesupport (= 3.1.4)
railties (= 3.1.10)
railties (3.1.10)
actionpack (= 3.1.10)
activesupport (= 3.1.10)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rbx-require-relative (0.0.5)
rake (10.0.3)
rbx-require-relative (0.0.9)
rdoc (3.12)
json (~> 1.4)
ruby-debug (0.10.4)
@@ -124,18 +127,18 @@ GEM
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
ruby-openid (2.1.8)
ruby-openid (2.2.2)
sprockets (2.0.4)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
sqlite3 (1.3.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
tzinfo (0.3.35)
warden (1.2.1)
rack (>= 1.0)
webrat (0.7.2)
@@ -151,7 +154,7 @@ DEPENDENCIES
activerecord-jdbcsqlite3-adapter
devise!
jruby-openssl
mocha
mocha (= 0.10.0)
mongoid (~> 3.0)
omniauth (~> 1.0.0)
omniauth-facebook

View File

@@ -27,7 +27,7 @@ module Devise
def headers_for(action, opts)
headers = {
:subject => translate(devise_mapping, action),
:subject => subject_for(action),
:to => resource.email,
:from => mailer_sender(devise_mapping),
:reply_to => mailer_reply_to(devise_mapping),
@@ -86,8 +86,8 @@ module Devise
# confirmation_instructions:
# subject: '...'
#
def translate(mapping, key)
I18n.t(:"#{mapping.name}_subject", :scope => [:devise, :mailer, key],
def subject_for(key)
I18n.t(:"#{devise_mapping.name}_subject", :scope => [:devise, :mailer, key],
:default => [:subject, key.to_s.humanize])
end
end

View File

@@ -168,7 +168,16 @@ module Devise
end
def apply_to_attribute_or_variable(attr, method)
(self[attr] || send(attr)).try(method)
if self[attr]
self[attr].try(method)
# Use respond_to? here to avoid a regression where globally
# configured strip_whitespace_keys or case_insensitive_keys were
# attempting to strip! or downcase! when a model didn't have the
# globally configured key.
elsif respond_to?(attr)
send(attr).try(method)
end
end
module ClassMethods

View File

@@ -64,7 +64,6 @@ module Devise
result = if valid_password?(current_password)
update_attributes(params, *options)
else
params.delete(:password)
self.assign_attributes(params, *options)
self.valid?
self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)

View File

@@ -1,3 +1,3 @@
module Devise
VERSION = "2.2.0".freeze
VERSION = "2.2.2".freeze
end

View File

@@ -6,7 +6,7 @@
<div class="form-inputs">
<%= f.input :email, :required => true, :autofocus => true %>
<% if resource.class.reconfirmable && resource.unconfirmed_email.present? %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
<% end %>

View File

@@ -214,7 +214,7 @@ class RegistrationTest < ActionController::IntegrationTest
sign_in_as_user
get edit_user_registration_path
click_link "Cancel my account", :method => :delete
click_button "Cancel my account"
assert_contain "Bye! Your account was successfully cancelled. We hope to see you again soon."
assert User.all.empty?
@@ -344,4 +344,4 @@ class ReconfirmableRegistrationTest < ActionController::IntegrationTest
assert_equal "admin.new@example.com", Admin.first.unconfirmed_email
assert Admin.first.valid_password?('pas123')
end
end
end

View File

@@ -34,6 +34,18 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
assert_equal email.strip, user.email
end
test "doesn't throw exception when globally configured strip_whitespace_keys are not present on a model" do
swap Devise, :strip_whitespace_keys => [:fake_key] do
assert_nothing_raised { create_user }
end
end
test "doesn't throw exception when globally configured case_insensitive_keys are not present on a model" do
swap Devise, :case_insensitive_keys => [:fake_key] do
assert_nothing_raised { create_user }
end
end
test "param filter should not convert booleans and integer to strings" do
conditions = { 'login' => 'foo@bar.com', "bool1" => true, "bool2" => false, "fixnum" => 123, "will_be_converted" => (1..10) }
conditions = Devise::ParamFilter.new([], []).filter(conditions)
@@ -120,13 +132,6 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
assert_match "is invalid", user.errors[:current_password].join
end
test 'should not change encrypted password when it is invalid' do
user = create_user
assert_not user.update_with_password(:current_password => 'other',
:password => 'pass4321', :password_confirmation => 'pass4321')
assert_not user.encrypted_password_changed?
end
test 'should add an error to current password when it is blank' do
user = create_user
assert_not user.update_with_password(:password => 'pass4321',