How about

password = CRYPT()(passwd)[0]

--
Thadeus





On Wed, Apr 21, 2010 at 6:54 PM, mdipierro <[email protected]> wrote:
>    ticket_master = db.auth_user.insert(first_name=fname,
>                                last_name=lname,
>                                email=maile,
>                                password=passwd)
>
> should be
>
>    ticket_master = db.auth_user.insert(first_name=fname,
>                                last_name=lname,
>                                email=maile,
>
> password=db.auth_user.password.requires[0](passwd)[0])
>
> On Apr 21, 4:32 pm, Patrick <[email protected]> wrote:
>> I have been learning web2py and decided to create a simple ticket
>> system. Thus far I've been able to read the book/documentation or look
>> at others code and been able to hack my way through most issues.
>> However in my situation I need to have a default user created for
>> default administrative purposes, such as adding other admin users (I
>> know this isn't the best way to accomplish this but I'm learning...
>> advice, suggestions always welcome).
>>
>> I've tried something similar to this post "http://groups.google.com/
>> group/web2py/browse_thread/thread/39f2d63f7024bbfb/2da45ae0132fe8fc?
>> lnk=gst&q=auto+users#2da45ae0132fe8fc", but I can't login as the user
>> because it says invalid login.
>>
>> I believe this is due to when I set the default password. If I login
>> appadmin and change the password and then try to login it works. So
>> I'm messing up on the password creation part. Here is the code for my
>> z_defuser.py:
>>
>> fname='ticket'
>> lname='master'
>> maile='[email protected]'
>> passwd='tmaster09!'
>>
>> # Check to see if the user exists first.
>> # If the user does do nothing, else create the new user.
>> rows = db(db.auth_user.email == maile).select()
>> if rows:
>>     pass
>> else:
>>     ticket_master = db.auth_user.insert(first_name=fname,
>>                                 last_name=lname,
>>                                 email=maile,
>>                                 password=passwd)
>>
>> P.S.
>> Any suggestions/advice are welcome. Thank you.
>

Reply via email to