Blacklight Plugin

Blacklight User -- validate confirmation of password only if password changed

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0, 2.1, 2.2, 2.3, 2.4, 2.5
  • Fix Version/s: 2.6
  • Component/s: None
  • Description:
    Hide
    I was running into trouble with a user profile "edit" page (Password doesn't match confirmation). It looks like one take on password confirmation is to only require it when the password changes (see http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/a11ca03dd4de61ea).

    ---

    diff --git a/app/models/user.rb b/app/models/user.rb
    index 372b62f..8901898 100644
    --- a/app/models/user.rb
    +++ b/app/models/user.rb
    @@ -11,7 +11,7 @@ class User < ActiveRecord::Base
       validates_uniqueness_of :email
       
       validates_presence_of :password, :on => :create
    - validates_confirmation_of :password
    + validates_confirmation_of :password, :if => :password_changed?
       
       validates_presence_of :login
       validates_uniqueness_of :login
    Show
    I was running into trouble with a user profile "edit" page (Password doesn't match confirmation). It looks like one take on password confirmation is to only require it when the password changes (see http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/a11ca03dd4de61ea). --- diff --git a/app/models/user.rb b/app/models/user.rb index 372b62f..8901898 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,7 +11,7 @@ class User < ActiveRecord::Base    validates_uniqueness_of :email        validates_presence_of :password, :on => :create - validates_confirmation_of :password + validates_confirmation_of :password, :if => :password_changed?        validates_presence_of :login    validates_uniqueness_of :login

Activity

Hide
Chris Beer added a comment - 27/Jul/10 12:04 PM
Fixed in commit 8ca7eceb569630f244dd
Show
Chris Beer added a comment - 27/Jul/10 12:04 PM Fixed in commit 8ca7eceb569630f244dd

People

Dates

  • Created:
    24/Mar/10 2:19 PM
    Updated:
    27/Jul/10 12:04 PM
    Resolved:
    27/Jul/10 12:04 PM