mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use a better method name to check the requirement of password confirmation
Also improve changelog entries related to secure password to proper highlight.
This commit is contained in:
parent
017b0fb08a
commit
3a33e8ea85
2 changed files with 8 additions and 8 deletions
|
@ -19,8 +19,8 @@
|
|||
|
||||
*Bogdan Gusiev*
|
||||
|
||||
* Fix has_secure_password. `password_confirmation` validations are triggered
|
||||
even if no `password_confirmation` is set.
|
||||
* Fix `has_secure_password` not to trigger `password_confirmation` validations
|
||||
if no `password_confirmation` is set.
|
||||
|
||||
*Vladimir Kiselev*
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
*Charles Bergeron*
|
||||
|
||||
* Fix regression in has_secure_password. When a password is set, but a
|
||||
* Fix regression in `has_secure_password`. When a password is set, but a
|
||||
confirmation is an empty string, it would incorrectly save.
|
||||
|
||||
*Steve Klabnik* and *Phillip Calvin*
|
||||
|
|
|
@ -57,9 +57,9 @@ module ActiveModel
|
|||
include InstanceMethodsOnActivation
|
||||
|
||||
if options.fetch(:validations, true)
|
||||
validates_confirmation_of :password, if: :should_confirm_password?
|
||||
validates_confirmation_of :password, if: :password_confirmation_required?
|
||||
validates_presence_of :password, on: :create
|
||||
validates_presence_of :password_confirmation, if: :should_confirm_password?
|
||||
validates_presence_of :password_confirmation, if: :password_confirmation_required?
|
||||
|
||||
before_create { raise "Password digest missing on new record" if password_digest.blank? }
|
||||
end
|
||||
|
@ -113,9 +113,9 @@ module ActiveModel
|
|||
|
||||
private
|
||||
|
||||
def should_confirm_password?
|
||||
password_confirmation && password.present?
|
||||
end
|
||||
def password_confirmation_required?
|
||||
password_confirmation && password.present?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue