Allowing either email address or username, and password for login credentials on v2.53 back end

6 posts by 3 authors in: Forums > CMS Builder
Last Post: December 23, 2013   (RSS)

By gkornbluth - December 15, 2013

Hi All,

A question that I should probably know the answer to already, but here goes.

How can I allow either email addresses or usernames, and passwords as login credentials in the admin back end login

It seems to work when using the login form, but not on the admin page login. I’m using the website membership plugin 1.10.

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - December 18, 2013

Thanks Daryl,

I'll give it a try in the morning.

I'm sure it will work just perfectly.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By ross - December 20, 2013

Hi Jerry

Another option here is you could modify your signup page so that it only asks for an email address. When a new member signs up, their email address becomes their username as well. This way, they only have one thing to remember.

For the accounts that have already been setup, you can do a quick SQL update to copy the email addresses to the usernames for all accounts.  What do you think?

We can help you with either part via consulting.

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By gkornbluth - December 21, 2013

Hi, Ross,

That would make it KISS simple.

I guess I could put in some error checking code to insure a validly formed email address was entered, and then insert the same information in the email field in new accounts.

I'll see if the client wants to go for the importing of email addresses into the username field.

Thanks,

Jerry

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By ross - December 23, 2013

Hi Jerry

Great! I sure do like the simple options as a starting point :).  Let me know what your client has to say and I can walk you through the next steps if you like.

In the meantime, you mentioned validating the email address is well formed and wanted to make sure you knew about the built in email validator :)

if (!@$_REQUEST['email'])                   { $errorsAndAlerts .= "You must enter your email!<br/>\n"; }
else if(!isValidEmail(@$_REQUEST['email'])) { $errorsAndAlerts .= "Please enter a valid email (example: user@example.com)<br/>\n"; }

See how I check first that an email address was entered, then use the isValidEmail function.  It's really quite handy.  Keep in mind that this is just checking that the email is a valid address (ie: has an "@" and a "." in it.  There is more code in the sample signup form that checks if the address already exists in the database.

Let me know what you think :).

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/