Thanks Michele! In fact I misunderstood the basic concept (see my other 
mail which is still stuck in moderation)
I thought reset_password_key is mandatory in all cases, in fact it's only 
needed upon password reset request as you suggested..

Cheers 
Toby

Am Dienstag, 30. Dezember 2014 12:59:40 UTC+1 schrieb Michele Comitini:
>
> A simple trick is to send the user (with user_id) a link (by mail or any 
> other way)
>
> You can do something like this (max_time is when you want the key to 
> expire)
>
>              user = db.auth_user(user_id)   
>             reset_password_key = str(int(max_time)) + '-' + web2py_uuid()
>             user.update_record(reset_password_key=reset_password_key)
>
>             link =auth.url(auth.settings.function,
>                             args=('reset_password', reset_password_key),
>                             scheme='https')
>
> You can put this in a file .py and call it from web2py.py using the -R  
> option on commandline.
>
>
>
> 2014-12-28 19:52 GMT+01:00 <[email protected] <javascript:>>:
>
>> Hey everybody,
>>
>> I added a couple of users programmatically as suggested on the mailing 
>> list using
>>
>> my_crypt = CRYPT(key=auth.settings.hmac_key)
>> crypt_pass = my_crypt(passw)[0]
>> id_user= db.auth_user.insert(username = username, email = email, password 
>> = crypt_pass)
>>
>> That's perfectly fine, but... the newly created users lack a *Reset 
>> password key*
>> How would I assign a Reset password key when creating users 
>> programmatically, so that users later can retrieve their password?
>>
>> Anybody could share a code snippet?
>>
>> Cheers
>> Toby
>>
>> -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.

Reply via email to