No Luck. Causes a missing key error. (db does not have a 'auth_table') Maybe this is new since 1.72.3? I tried numerous permutations without success. I am deleting the database files and restarting the server for each test.
Karl On Dec 25, 7:20 am, mdipierro <[email protected]> wrote: > replace > > password=hmac.new(key, 'jh', hashlib.sha512).hexdigest() > > with > > password=db.auth_table.requires('yourpassword')[0] > > I think the problem is that if you use hashlib.sha512 you have to add > 'sha512:' in front of the hexdigest. look into CRYPT for details. > > On Dec 25, 4:31 am, kbochert <[email protected]> wrote: > > > When I startup web2py without a database, it creates it. When this > > happens I wish to 'pre-load' some data for testing. > > How do I create a user with a password? > > > I'm putting code in db.py like: > > > if not db().select(db.auth_user.ALL): #database is empty > > import hashlib > > key = auth.settings.hmac_key > > > #users > > userid = db.auth_user.insert(first_name='Joe', > > last_name='Hill', > > email='[email protected]', > > password = hmac.new(key, 'jh', hashlib.sha512).hexdigest() > > ) > > #groups > > clientgp = auth.add_group('client', '') > > #permissions > > auth.add_permission(clientgp,'create', 'product', 0) > > #links > > auth.add_membership(clientgp, userid) > > > which creates the user appropriately, but the user:password does not > > work. > > > Karl -- You received this message because you are subscribed to the Google Groups "web2py-users" 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/web2py?hl=en.

