I've imported some customers and the passwords could not be migrated. This is no big issue.
All the customers were notified to change their password.
But in the mean time, the Date of Birth
field became mandatory, and the migrated customers did not have a birth date filled in.
Now the problem.
A customer requests a password change.
He receives an e-mail and clicks on the link for password reset.
He fills in his new password and submits the form.
Expected result
Password is changed.
Actual result
An error message appears at the top of the page: The Date of Birth is required..
Any pointers on how I can work around this and still keep the birth date mandatory for new customers?.
Issue appears on ce-1.7.0.2, but I have a feeling that the version is not important here.
Best Answer
it happened again. I got the solution less than 1 hour after posting the question.
But before posting it I want to say that this looks like a Magento bug to me.
Customers should be able to change their password even if the customer settings have been changed.
The obvious thing to do is to remove the line (and other ones related to it)
from the
Mage_Customer_AccountController::resetPasswordPostAction
.I don't think a full validation is required here since we are changing only the password.
All the other fields can be changed once the customer gets access to his account. (FOR WHICH HE NEEDS A PASSWORD)
But I didn't remove that, in case there is an other reason that I'm missing.
Here is what I did just for this particular case.
Since I only need to skip this validation on the recover password page, I observed the event
controller_action_predispatch_customer_account_resetpasswordpost
and just registered a value.and the observer method looks like this:
And I've overwritten the
validate
method in the customer model. I didn't find an event for it.Basically it looks the same as in
Mage_Customer_Model_Customer
except for this part.In my class it looks like this: