no, but there is a retrieve_username.

Mind that web2py knows how to handle a field called username. Have you
tried just the following?

...
    Field('username', length=32, label="User Name")
...
db.auth_user.username.requires   =  [IS_LENGTH(minsize=3,
error_message="Three or more characters required"), IS_NOT_IN_DB(db,
table.username)]

def user(): return dict(form=auth())


On Sep 16, 7:18 pm, John Heenan <johnmhee...@gmail.com> wrote:
> I have fixed my own problem. I had a spelling mistake; 'writable' does
> not have an extra e in it!
>
> Upon fixing the problem I needed to make a slight adjustment to the
> code to make it work properly. If there are no arguments to the user
> function then a redirection to user/login (even if logged in already)
> occurs so the code still works.
>
> Here is the adjustment:
>
> def user():
>     if request.args and request.args[0] in ('register', 'login'):
>       auth.settings.table_user.username.writable=True
>     return dict(form=auth())
>
> Now I wonder if there an easy way to also include the username field
> for user/retrieve_password ?
>
> John Heenan
>
> On Sep 16, 5:09 pm, John Heenan <johnmhee...@gmail.com> wrote:
>
> > I want to make an added username field of a custom auth_user table
> > writeable with registration.
>
> > This is how the custom non writeable field is defined:
> >     db.Field('username', length=32, label="User Name",
> > writable=False,),
>
> > The require attribute is added externally:
> > table.username.requires   =  [IS_LENGTH(minsize=3,
> > error_message="Three or more characters required"), IS_NOT_IN_DB(db,
> > table.username)]
>
> > This is how I alter the alter writeable attribute for registration
>
> > def user():
> >   if request.args and request.args[0]=='register':
> >     auth.settings.table_user.username.writeable=True
> >   return dict(form=auth())
>
> > The field does not change to a writeable one in the registration
> > action.
>
> > I don't know what else I need to do to make the field writeable.
>
> > John Heenan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to