Got it. You can do something like this:
def user():
form = auth()
if form.errors.old_password:
form.errors.old_password = 'Please enter the old password'
return dict(form=form)
We should probably fix this by having a setting like
auth.messages.missing_old_password. Please open an issue on Github and link
back to this thread.
Anthony
On Friday, September 8, 2017 at 5:43:54 AM UTC-4, Simona Chovancová wrote:
>
> Because if user submits my change_password form and leaves everything
> empty, I do not want 'Too short' to be error message for the old password
> field but rather something different.. and that did not change the
> error_message on it
>
> On Wednesday, September 6, 2017 at 5:27:33 PM UTC+2, Anthony wrote:
>>
>> Why do you want to validate the old password? The only requirement should
>> be that it actually matches the old password, and therefore the only error
>> message you would want to report is that the password doesn't match (which
>> can be customized via auth.messages.invalid_password).
>>
>> Anthony
>>
>> On Wednesday, September 6, 2017 at 6:08:00 AM UTC-4, Simona Chovancová
>> wrote:
>>>
>>> I have a table defined like this:
>>>
>>> form_change_password = auth.change_password()
>>> form_change_password.element(
>>> 'input', _name='old_password')['_id'] = 'form-4'
>>> form_change_password.element(
>>> 'input', _name='new_password')['_id'] = 'form-5'
>>> form_change_password.element(
>>> 'input', _name='new_password2')['_id'] = 'form-6'
>>>
>>> When I leave all fields empty, the new_password has same error_message
>>> as any other password, edited using db.auth_user.password.requires = ...,
>>> but the old_password has just 'Too short' as error_message, how do I change
>>> old_password's error_message?
>>> Thank you.
>>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.