Never mind. I worked too much. This posting can be ignored.
On Thursday, January 17, 2013 4:47:45 PM UTC+1, Sverre wrote:
>
> I defined a custom auth.user table like
>
> db.define_table(
>
> auth.settings.table_user_name,
> Field('username', length=20, default=''),
> Field('first_name', length=128, default=''),
> Field('last_name', length=128, default=''),
> Field('email', length=128, default='', unique=True), # required
> Field('password', 'password', length=512, # required
> readable=False, label='Password'),
> Field('description','text',label='Comment'),
> Field('registration_key', length=512, # required
> writable=False, readable=False, default=''),
> Field('reset_password_key', length=512, # required
> writable=False, readable=False, default=''),
> Field('registration_id', length=512, # required
> writable=False, readable=False, default=''))
>
>
> ## do not forget validators
> custom_auth_table = db[auth.settings.table_user_name] # get the
> custom_auth_table
> custom_auth_table.username.requires = IS_NOT_EMPTY(error_message=auth.
> messages.is_empty)
> custom_auth_table.first_name.requires = IS_NOT_EMPTY(error_message=auth.
> messages.is_empty)
> custom_auth_table.last_name.requires = IS_NOT_EMPTY(error_message=auth.
> messages.is_empty)
> #custom_auth_table.password.requires = [IS_STRONG(), CRYPT()]
> custom_auth_table.email.requires = [
> IS_EMAIL(error_message=auth.messages.invalid_email),
> IS_NOT_IN_DB(db, custom_auth_table.email)]
>
>
> auth.settings.table_user = custom_auth_table # tell auth to use
> custom_auth_table
>
>
> Then I defined a view index.html just including a link with the class btn.
> When I'm accessing the destination page I'm getting "Not authorized". This
> was working before until I added a login rule for the destination
> controller:
>
> # coding: utf8
> # try something like
> #@auth.requires_login()
> def index():
> return dict()
>
> #@auth.requires_login()
> def organisations():
> table = db.organisations
> query = (table.id>0)
> return dict(grid=SQLFORM.grid(query))
>
> So I'm logged in with a user and this user has no access rights even when
> I commented the access roles.
>
>
>
--