Bugs: Browse | Submit New | Admin

[#8267] encrypt_password should be in before_save, not after_validation

Date:
2007-01-29 11:10
Priority:
3
Submitted By:
Daniel Weinand (dweinand)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
encrypt_password should be in before_save, not after_validation

Detailed description
In UserMixin?.rb:

~125:
# After validation, the password should be encrypted  
after_validation :encrypt_password

should be changed to 
# before save, the password should be encrypted  
before_save :encrypt_password

Otherwise, calling user.valid? will cause the password to be encrypted, and will cause a subsequent user.save to fail
because of the

~403:   if @new_hash_type and not (@new_password or password.nil?)

since encrypt_password resets @new_password.

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item