Email login instead of username?

Email login instead of username?, a forum discussion on Jojo CMS. Join us for more discussions on Email login instead of username? on our General Discussion forum.

Back to Forum Index : Back to General Discussion   RSS
ayoub

29 Jan 2010
Posts: 39

Any idea on how to achieve email login instead of username anyone?
Harvey

Core Developer

Harvey

2 Feb 2010
Posts: 327

Shouldn't be too hard, but you will need to make some small changes to the core.

I haven't tested this, but you should be able to get this working by editing plugins/jojo_core/classes/Jojo/Auth/Local.php

Line 12 is where the action happens...

$logindata = Jojo::selectRow("SELECT * FROM {user} WHERE us_login = ? AND (us_password = SHA1(CONCAT(?, us_salt)) OR us_password = MD5(CONCAT(?, us_salt))) AND us_locked = 0", $values);


In the above query, change 'us_login' to 'us_email'.

If that works, you will need to update some of the other queries in this file - notably the ones that log failed login attempts and loct the account after 10 bad attempts. This file is well commented and not so difficult to understand what is happening.

You will also want to update the template files to change to 'email' instead of 'username', should be easy to do.

Feel free to submit your code once it's working - this is something we would implement into the core, at least as an option rather than the default.
tom

Developer

tom

2 Feb 2010
Posts: 379

Other way would be to adapt the user registration form to make the real login field a hidden one and set the email field to copy to both the us_login and us_email fields. That way you won't run into issues with having to tweak every plugin that uses user data (cart, forums, articles etc)
ayoub

2 Feb 2010
Posts: 39

ThanK You.

Will use Harvey's method since I'm not planning on using the plugins.

I will post my code when done.
damien damien

17 May 2010
Posts: 24

I wouldnt highly recommend it, but if you extend the size of the username field in the database, im pretty sure it used to let you put email addresses in the username field
Back to Forum Index : Back to General Discussion   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.