Login by email

A place for users and developers of the Xataface to discuss and receive support.

Login by email

Postby sophistry » Fri Jun 13, 2008 7:30 am

Has anyone set up an ability for users to login using their email address instead of their username?

I'm hoping its something easy, but I'd like to hear if anyone else ahs done it.

Thanks,
sophistry
sophistry
 
Posts: 27
Joined: Mon May 19, 2008 11:20 am

Postby shannah » Mon Jun 16, 2008 2:29 pm

Why not just use the email field as the username column.

E.g. if your users table has an email_address column, you would have something like the following in your conf.ini file:

Code: Select all
[_auth]
    users_table=users
    username_column=email_address
    password_column=password


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby sophistry » Mon Jun 16, 2008 2:41 pm

I ended up trying this, and it somewhat seems to work, but I'm trying to juggle some code and configurations to get authentication and permissions to act nice together, so I haven't had time to really check to make sure its working. I'd bet it would work, though.

I was trying to add some snippets to my Users.php under the appropriate table to make sure you couldn't create an account with a duplicate email address, and I'm trying to overcome some hurdles in that department. There's a host of information on this (and the weblite) site, so I've been sifting through those.

I always go back to the Web Auction source code for ideas, and am usually pleased with results, but I'm mostly just an armchair coder, so I'm trying to piece it all together. :)

Thanks again, Steve
sophistry
sophistry
 
Posts: 27
Joined: Mon May 19, 2008 11:20 am

Postby shannah » Mon Jun 16, 2008 2:55 pm

make sure you couldn't create an account with a duplicate email address


If you make the email_address field unique in mysql, that should effectively prevent people from registering with a duplicate email address.

Also, can't remember if this is built in (if it isn't it should be), but Xataface should check to make sure the username is unique when the user registers. So if you set the email column as your username column, xataface should take care of this.... if not, then this is a bug that needs to be fixed.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby sophistry » Mon Jun 16, 2008 7:20 pm

Good point, I wasn't even thinking of that. I just changed the email field to unique, that should take care of any issues. That might free me up to take out a number of things I had in the Users.php - which probably caused the registration problems. I'm still having an issue setting up permissions so Anonymous users have read_only access, logged in users can add/edit their own records in a 'favorites' table, and make sure registering users can't change their role. I think it's coming together, but just when I think I've got it ... anonymous users seem to have the ability to change anything. I'm going to look into it now, but if I have issues I'll come back and maybe find some more info on it.

Thanks
sophistry
 
Posts: 27
Joined: Mon May 19, 2008 11:20 am

Postby sophistry » Tue Jun 17, 2008 7:29 pm

This does work, I just have to write something into .. Users.php maybe .. to give an error when trying to register an email that already exists in the table.

Otherwise, what file contains the information on the login page? I need to change Username: to Email:
sophistry
 
Posts: 27
Joined: Mon May 19, 2008 11:20 am

Postby Jean » Wed Jun 18, 2008 12:51 am

Hi Sophistry,

You go into xataface/xataface/templates/
and you copy the file Dataface_Login_Prompt.html into %yourapplication%/templates/ .
May be you'll have to create this directory.
Then you edit this file and replace username by email.

Jean
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby sophistry » Wed Jun 18, 2008 5:45 pm

I've copied /dataface/templates/Dataface_Login_Prompt.html into /templates, and edits to that file don't seem to be having an effect. Other templates files I've copied into /templates do override properly. I'm not sure why this is different.
sophistry
 
Posts: 27
Joined: Mon May 19, 2008 11:20 am

Postby shannah » Tue Jun 24, 2008 10:08 am

I've copied /dataface/templates/Dataface_Login_Prompt.html into /templates, and edits to that file don't seem to be having an effect.


Sorry this one got lost in the mix. You are indeed working with the correct template. Have you successfully customized a xataface template before? (e.g. copied a template from the dataface templates folder into the application's templates folder). The reason I ask is to rule out the possibility that your custom template is in the wrong place or something.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 28 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved