Hallelujah, its a Christmas miracle!

Many Thanks, seems almost obvious now!

Karl

Given that the loading of an initial database is probably a useful
On Dec 26, 2:44 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I guess it is not my may. I apologize I did not try my suggestion
> before trying it.
> Here is more guess:
>
> password=db.auth_user.password.requires[0]('yourpassword')[0]
>
> Let me explain:
> db.auth_user is the table
> db.auth_user.password is the field
> db.auth_user.password.requires is the list of validators
> db.auth_user.password.requires[0] is the first and only validator
> (CTRYPT())
> db.auth_user.password.requires[0]('...') calls the validator and
> return (hashed_password,None)
> db.auth_user.password.requires[0]('...')[0] is the properly hashed
> password whatever the CRYPT parameters are
>
> On Dec 26, 4:25 pm, kbochert <kboch...@copper.net> wrote:
>
> > Sigh--
> > With that line  I get:
>
> > ---
> >     The page isn't redirecting properly
>
> >     Firefox has detected that the server is redirecting the request
> > for this address
> >     in a way that will never complete.
>
> > ---
>
> >  While experimenting I once got a (wrong) page with a url (in the
> > firefox url bar) that looked like many concatenated url's, each with
> > an error ticket attached
>
> > Karl
>
> > On Dec 26, 7:39 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > password=db.auth_user.password.requires('yourpassword')[0]
>
> > > On Dec 26, 7:46 am, kbochert <kboch...@copper.net> wrote:
>
> > > > Traceback (most recent call last):
> > > >   File "gluon/restricted.py", line 184, in restricted
> > > >   File "E:/web2py1.72.3/applications/mug/models/db.py", line 103, in
> > > > <module>
> > > >   File "gluon/sql.py", line 1498, in __getattr__
> > > > KeyError: 'requires'
>
> > > > Note I'm using 1.72.3 until I get 1.74.4 working
>
> > > > Karl
>
> > > > On Dec 25, 12:54 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > Silly me. Too much food.
>
> > > > > password=db.auth_user.requires('yourpassword')[0]
>
> > > > > On Dec 25, 1:12 pm, kbochert <kboch...@copper.net> wrote:
>
> > > > > > 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 <mdipie...@cs.depaul.edu> 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 <kboch...@copper.net> 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='jh...@copper.net',
> > > > > > > >         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 web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to