Commonly in internet, the users create their accounts,  via
(/myapp/default/user/register/)

But if you want to create some accounts take a look to this:


def new_user(first_name, last_name, email, passw):


        users = db(db.auth_user.email==email).select()
        if users:
            return users[0].id
        else:
            my_crypt = CRYPT(key=auth.settings.hmac_key)
            crypt_pass = my_crypt(passw)[0]
            id_user= db.auth_user.insert(
                                       first_name=first_name,
                                       last_name=last_name,
                                       email = email,
                                       password = crypt_pass

                                       )
            return id_user



iduser = new_user('Chris','Mills','ch...@nobody.com','somepasswordhere')

2011/1/3 mdipierro <mdipie...@cs.depaul.edu>:
> I do not understand the question.sorry.
>
> On Jan 3, 3:46 pm, Rick <sababa.sab...@gmail.com> wrote:
>> Hi,
>>
>> I suppose that this is a very elementary question, but I can't find
>> the solution. My question is -- how to make a account for each user?
>>
>> I've tried with this code, but it gives just one account for all user:
>>
>> ==on the model file==
>> db.define_table(
>>    auth.settings.table_user_name,
>>    Field('username'),
>>    Field('password'),
>>    Field('registration_key', default=''))
>> auth.define_tables()
>> custom_auth_table = db[auth.settings.table_user_name] # get the
>> custom_auth_table
>> db.define_table('day',
>>        Field('person', db[auth.settings.table_user_name]),
>>        Field('thedate','date'),
>>        Field('value', 'integer'))
>>
>> ==in a controller file==
>> @auth.requires_login()
>> def create():
>>        some code
>>
>> def user():
>>    return dict(form=auth())



-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com
Expert4Solution Profile:
http://www.experts4solutions.com/e4s/default/expert/6

Reply via email to