Reputation: 2677
Is there a simple/recommended way to let the user change the password with the form generated by auth.profile()
? I'm looking at the def profile()
code in gluon/auth.py, and the table_user[passfield].writable = False
line suggests that this form isn't used for changing the password, yet it seems like it should have this functionality.
Upvotes: 0
Views: 175
Reputation: 25536
web2py's Auth system includes a separate Auth.change_password()
method specifically for changing the password (rather than including just a single password field, it also includes fields for the old password and to confirm the new password). In the scaffolding application, it is accessible via /default/user/change_password, and it is included as a menu option in auth.navbar()
.
If you want a single form that includes the profile and password change functionality, you will have to code your own custom action. You could simply create a form that includes all the user fields (including the password field) via SQLFORM(db.auth_user)
. However, if you want to require and then validate the old password and a confirmation of the new password, you will need to customize the form and code the validation logic yourself.
Upvotes: 1