Hi Luca,
Not sure whether it is the best way, but I have this code to auto-create
my first user:
if not dbauth(dbauth.auth_user.id>0).count():
dbauth.auth_user.insert(first_name="Admin",last_name="Username",email=
"[email protected]",
password=dbauth.auth_user.password.requires[0]('mypassword')[0])
auth.add_membership('admin', dbauth.auth_user(1) )
auth.login_bare('email','password') logs in a user. Not sure what your
problem is there.
Regards,
David
On Tuesday, 22 May 2012 06:18:29 UTC+1, Luca wrote:
>
> To validate a user-password pair, I can use auth.login_bare.
> Two questions:
>
> 1. Auth.login_bare does not cause the user to be logged in: for
> instance, auth.user_id is not set afterwards. Is there a way to also log
> in a user, not only validate the username/password pair?
> 2. Suppose I want to programmatically create a user account (e.g., to
> build a back end for a mobile app, that only has a json interface). Is
> there an auth.create_user(first_name, last_name, email, password) method?
>
> Thanks!
>
> Luca
>