> well, the problem then is that if you WANT to use email as username, you
> have duplicate fields;

Actually as I am implementing OpenID, I am finding a need for a
separate field. In websites where you need to publicly display the
person's username, such as with comments etc... your users might not
like it if you displayed their email or First/Last name to the whole
Internet.


On Aug 6, 6:47 pm, Yarko Tymciurak <yark...@gmail.com> wrote:
> On Thu, Aug 6, 2009 at 8:42 PM, Bottiger <bottig...@gmail.com> wrote:
>
> > Well you see, unlike the "username" column, the "email" column is
> > actually defined.
>
> > So there are 3 possible solutions.
>
> > 1. Define a "username" column in the "auth_user" table by default.
>
> well, the problem then is that if you WANT to use email as username, you
> have duplicate fields;
> I don't like this solution;
>
>
>
> > 2. Change "username" to a column that is actually defined, such as
> > "first_name"
>
> It would have to be unique, and this isn't reasonable constraint for
> first_name or last_name (or even a combination of the two);
> I don't like this either;
>
>
>
> > 3. Remove the "username" check and usage completely.
>
> I think I like my action:  try username if that is what is passed in the
> dict, perhaps raise a ticket a single time,
> and fall back to 'email' if 'username' doesn't exist.
>
> What do others think?
>
>
>
> > On Aug 6, 6:38 pm, Yarko Tymciurak <yark...@gmail.com> wrote:
> > > I see - so you would want an exception to be raised?   What do you
> > propose?
>
> > > On Thu, Aug 6, 2009 at 8:26 PM, Bottiger <bottig...@gmail.com> wrote:
>
> > > > The function takes a dictionary where if the username key is defined,
> > > > then it assumes that your database has a "username" column which is
> > > > incorrect behavior.
>
> > > > On Aug 6, 6:16 pm, Yarko Tymciurak <yark...@gmail.com> wrote:
> > > > > On Thu, Aug 6, 2009 at 8:09 PM, Bottiger <bottig...@gmail.com>
> > wrote:
>
> > > > > > I am using the latest version.
>
> > > > > By "latest version" do you mean revision 1062 from Launchpad, or do
> > you
> > > > > mean
>
> > > > > > I know there is a check, but the check is useless. If you specify a
> > > > > > username in the dictionary that comes with the argument, then it
> > will
> > > > > > automatically assume that your auth_users table has a username
> > column,
> > > > > > which isn't the case.
>
> > > > > You you define the auth_users table, then you can define this
> > additional
> > > > > field;
> > > > > if not, it uses the email field.
> > > > > This is how it is designed.
>
> > > > > Am I missing something?
>
> > > > > > On Aug 6, 5:58 pm, Yarko Tymciurak <yark...@gmail.com> wrote:
> > > > > > > Which version of web2py are you looking at?
>
> > > > > > > First - in the most current version, I think you are talking
> > about
> > > > line
> > > > > > 653,
> > > > > > > in
> > > > > > > get_or_create_user();
>
> > > > > > > You will note at the beginning of that function:
>
> > > > > > >     if 'username' in keys:
> > > > > > >             username = 'username'
> > > > > > >         elif 'email' in keys:
> > > > > > >             username = 'email'
> > > > > > >         else:
> > > > > > >             raise SyntaxError, "user must have username or email"
>
> > > > > > > (there are 2 other places with lines like this, and they do
> > similar
> > > > > > checks;
> > > > > > > so you can define a username in your auth, or by default it uses
> > > > email).
>
> > > > > > > You might want to get a look at:
>
> >http://bazaar.launchpad.net/~mdipierro/web2py/devel/annotate/head%3A/<http://bazaar.launchpad.net/%7Emdipierro/web2py/devel/annotate/head%3A/>
> > <http://bazaar.launchpad.net/%7Emdipierro/web2py/devel/annotate/head%3A/>
> > > > .<
> >http://bazaar.launchpad.net/%7Emdipierro/web2py/devel/annotate/head%3A/
> > > > .>
> > > > > > ..
>
> > > > > > > BEWARE:  if you get the latest revision from launchpad, there is
> > a
> > > > bug in
> > > > > > > template.py - which I'm waiting for Massimo to apply the patch
> > for...
> > > > > >  You
> > > > > > > can remove the ".read()" portion of line 120 yourself in the
> > > > meantime,
> > > > > > that
> > > > > > > is in parse_template():
>
> > > > > > >         try:
> > > > > > >             fp = open(t, 'rb').read()
> > > > > > >             parent = fp.read()
> > > > > > >             fp.close()
>
> > > > > > > should read:
>
> > > > > > >         try:
> > > > > > >             fp = open(t, 'rb')
> > > > > > >             parent = fp.read()
> > > > > > >             fp.close()
>
> > > > > > > - Yarko
>
> > > > > > > On Thu, Aug 6, 2009 at 7:29 PM, Bottiger <bottig...@gmail.com>
> > > > wrote:
>
> > > > > > > > I am trying to incorporate OpenID into Auth.
>
> > > > > > > > In my attempt to implement a CAS style plugin into auth, I
> > stumbled
> > > > > > > > upon a bizzare error.
>
> > > > > > > > On line 628 of gluon.tools, there is the following line:
>
> > > > > > > > "users = self.db(table_user[username] ==
> > keys[username]).select()"
>
> > > > > > > > username is defined to be "username" if you have a username and
> > > > > > > > "email" if you have email specified. However, when I looked at
> > the
> > > > > > > > auth_user table, there is no "username" column.
>
> > > > > > > > The closest thing to a username column is first_name or
> > last_name,
> > > > but
> > > > > > > > obviously this isn't the same thing.
--~--~---------~--~----~------------~-------~--~----~
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