[web2py] Re: How to have a single user application

2013-02-10 Thread Niphlod
you should figure out a way to auto-login the user at the first use of the 
application. Depending on how your app is structured YMMV, but it shouldn't 
be hard.

On Sunday, February 10, 2013 7:39:49 PM UTC+1, rjmolesa wrote:

 I'm interested in branching my current application so that it will be 
 single user desktop application. As such I don't want the user to have to 
 register but I want to maintain auth tables and settings. Essentially I 
 want a user to be able to download the app and begin using it right away as 
 a 'default' user. Has anyone tackled this before? How did you solve the 
 issue?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: How to have a single user application

2013-02-10 Thread Massimo Di Pierro
if not db(db.auth_user).isempty(): 
auth.settings.disabled_actions.append('register')

and only one user will be able to register.

On Sunday, 10 February 2013 12:39:49 UTC-6, rjmolesa wrote:

 I'm interested in branching my current application so that it will be 
 single user desktop application. As such I don't want the user to have to 
 register but I want to maintain auth tables and settings. Essentially I 
 want a user to be able to download the app and begin using it right away as 
 a 'default' user. Has anyone tackled this before? How did you solve the 
 issue?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: How to have a single user application

2013-02-10 Thread Bruno Rocha
models/db.py

db = DAL(.)
from gluon.tools import Auth
auth = Auth(db).define_tables()

# if forst time running create the new user
if db(db.auth_user).isempty():
password = CRYPT()(12345)[0]
db.auth_user.valdiate_and_insert(first_name=default,
last_name=default,
email=s...@email.com,
password=password)

# automatically login the user
user = auth.login_bare(s...@email.com, 12345)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.