[web2py] Re: create auth_user programatically?

2010-11-16 Thread villas
I'm sure that you can insert a user easily enough.  I think you'll
need the CRYPT validator to encrypt the password.

-D


[web2py] Re: create auth_user programatically?

2010-11-16 Thread mdipierro
db.auth_user.insert(password=db.auth_user.password.validate(password),...)

On Nov 16, 3:34 am, villas villa...@gmail.com wrote:
 I'm sure that you can insert a user easily enough.  I think you'll
 need the CRYPT validator to encrypt the password.

 -D


[web2py] Re: create auth_user programatically?

2010-11-16 Thread Carlos
Thanks, but I can still insert multiple users with the same login
(email/password combination), which should not be allowed.

I need to have the same validations that are executed when the user
tries to register via web requests.

Is there anything automatic I can use or should I check manually?.

Furthermore is there a way I can programatically execute a crud.create
with data I provide (as if it came from a web request)?.

Thanks again,

   Carlos


On Nov 16, 6:07 am, mdipierro mdipie...@cs.depaul.edu wrote:
 db.auth_user.insert(password=db.auth_user.password.validate(password),. 
 ..)

 On Nov 16, 3:34 am, villas villa...@gmail.com wrote:







  I'm sure that you can insert a user easily enough.  I think you'll
  need the CRYPT validator to encrypt the password.

  -D


[web2py] Re: create auth_user programatically?

2010-11-15 Thread ron_m
Look in gluon/tools.py at the Auth class, function register to see how
it is done with the code behind the register form. Some of this
function builds the form for initial posting, then on submit the
function is revisited and the real work of adding the user is done in
the if form.accepts(): area of the function.

On Nov 15, 4:42 pm, Carlos carlosgali...@gmail.com wrote:
 Hi,

 What's the best way to create an auth_user programatically?.

 If I do db.auth_user.insert(...), then the password is not encrypted
 and the validations are not executed, as far as I can tell.

 In order to accomplish this, is it possible to execute a
 crud.create(...) as if the form data was already posted, such that the
 insert is done automatically (but without any web requests)?.

 Thanks,

    Carlos