[web2py] Re: auth_user manually insert/update the password

2011-04-12 Thread Anthony
On Tuesday, April 12, 2011 12:01:26 PM UTC-4, Bob wrote: 
>
> Thanks Anthony 
>
> Hiding with javascript will not work because it will get submitted 
> with javascript.

 
If you use an update form, the hidden password field should be 
pre-populated, so when you submit, it shouldn't replace the password with a 
blank (at least it doesn't when I try it).
 
Anthony


[web2py] Re: auth_user manually insert/update the password

2011-04-12 Thread Bob
Thanks Anthony

Hiding with javascript will not work because it will get submitted
with javascript. But I will try the readable/writable trick, thanks

Bob


[web2py] Re: auth_user manually insert/update the password

2011-04-12 Thread Anthony
On Tuesday, April 12, 2011 9:59:00 AM UTC-4, Bob wrote: 
>
> 2. In similar situation using SQLFORM. When updating the user it's 
> logical to leave the password blank in case you don't want to change 
> it. But SQLFORM crypts the blank and changes the password in the DB

 
If you pass the record id to SQLFORM via the 'record' argument, you'll get 
an update form with the password field pre-populated, so it won't get 
replaced with a blank. Or you can completely prevent the password field from 
being displayed by temporarily setting its 'readable' and 'writable' 
attributes to False. You could also initially hide the (pre-populated) 
password field in the view, and then use javascript to show the field if the 
user decides to change the password.
 
Anthony


[web2py] Re: auth_user manually insert/update the password

2011-04-12 Thread Anthony
On Tuesday, April 12, 2011 9:59:00 AM UTC-4, Bob wrote: 
>
> Hello, could someone answer a couple of questions: 
>
> 1. Is it possible to manually crypt the password in the same way that 
> crud() does it? 
> The reason is that I need to manually update the user with 
> db().update() and can't use crud

 
I think you can get a hashed password with:
 
CRYPT()('yourpassword')[0]
 
Anthony