Hurray, I'm getting somewhere now! Thanks pbreit, now I try to do what
I want to do without modifying the authentication functionality and it
works better. But I get the message "invalid function" when I try to
login. Here is the code:

===in the model file===
auth = Auth(globals(), db)
auth.define_tables(username=True)

===in the controller file===
def users():
        return users[0].id

def admin():
        records = db().select(auth.settings.table_user.ALL,
orderby=auth.settings.table_user.username)
        form = SQLFORM(auth.settings.table_user,
fields=['username','password'],)
        if form.accepts(request.post_vars, session):
                session.flash = 'Address saved.'
                redirect(URL('admin'))
        return dict(form=form, records=records)

===in user.html===
{{extend 'layout.html'}}
<h2>{{=request.args(0).replace('_',' ').capitalize()}}</h2>
{{=form}}
{{if request.args(0)=='login':}}
{{pass}}


>On Jan 16, 3:24 am, Rick <sababa.sab...@gmail.com> wrote:
> ...or maybe the problem lies int this function in the controller file:
> def admin():
>         records = db().select(custom_auth_table.ALL,
> orderby=custom_auth_table.username)
>         form = SQLFORM(db[auth.settings.table_user_name])
>         if form.accepts(request.post_vars, session):
>                 session.flash = 'saved.'
>                 redirect(URL('admin'))
>         return dict(form=form, records=records)
>
> On Jan 16, 1:08 am, Rick <sababa.sab...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Perhaps I should reformulate the problem -- I want to make one table
> > for each auth-user, so that an auth-user can't see the records of
> > ohters auth-users.
>
> > On Jan 15, 11:52 pm, pbreit <pbreitenb...@gmail.com> wrote:
>
> > > I may not understand either. The user authentication functionality is 
> > > automatically provided by web2py scaffolding. I would suggest using it 
> > > without modifications until you run into limitations.

Reply via email to