On Wednesday 15 October 2008 18:05:18 Kirk Strauser wrote:
> Right now the PasswordField widget on my user editing form shows the same
> number of asterisks as their password, which is perfectly normal and
> reasonable. I'm calling it like so:
>
> class UserInfoSchema(validators.Schema):
> chained_validators = [validators.FieldsMatch('password',
> 'passwordverify')]
>
> edituserform = widgets.TableForm(fields=EditUser(),
> action="/admin/saveuser", validator=UserInfoSchema())
>
> AdminController(controllers.RootController):
> [....]
> @expose('lite.templates.admin.edituser')
> def edituser(self, user_id, tg_errors=None):
> user = User.query.filter_by(user_id=user_id).one()
> return {'user' : user, 'userform': edituserform }
>
>
> and embedding that form in a template with:
>
> <p py:content="userform.display(submit_text='Update user information',
> value=user)">User information form</p>
>
>
> Now, I'd like to change it to either show no asterisks or a set number of
> asterisks (probably by generating an unlikely password and then checking
> for that value later) so that the passwords aren't updated unless the user
> actually types something in there, and so that the unencrypted password
> isn't sent to the user in the "value" attribute of the "<input
> type="password">" field. I'm pretty certain I'm not the first person to
> want to do this, so how do others do this idiomatically?
userform.display(dict(password="fake", passwordverify="fake",
username=<the-real-username>))
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---