0

We have currently have a login process that uses a front page to handle the login process then redirects the user back to the Front page and logs the user in.

Part of the reason for this process is that there have been several different platforms that have been migrated into the single wordpress that we are about to roll out. The issue is there are several different ways that users can log in including the email address, a username that existed in a legacy system, an id that orginated in yet another system, and our current unique numeric id.

It is currently possible to login through the 3rd party platform with all 4 different methods. Our business has directed us to keep this functionality.

My idea is to catch the submit in the log in process, call a rest service and pass them the id that was submitted, then that service will return the standardized id, then use the wordpress login function to log in using the username returned from the service, and the password entered in the Login Form.

I am not a wordpress developer, but in a standard html page this would be simple to do with javascript.

Is there any reason I cannot or should not implement this process for our new site? If so is there a better to handle this scenario?

3

For anything that deals with logins a server-side solution is more secure and compatible (i.e. if they don't have JS enabled, they still get the pared-down version). It's also generally safer to use existing functionality with plugins sprinkled in sparingly so that others who keep up with Core modifications can maintain the code.

You could handle 3 out of 4 of these methods server-side with WP's built-in login system: each user has an email address (use the one from the legacy system), a username (use the one from the other legacy system), and an id (use one from one of the other legacy systems - as long as you're careful you can change the one WP assigns to another number, you just have to change the usermeta table as well, and if any are authors, make sure to change the author id in the wp_posts table).

If any of the legacy systems are routed through or could be retrofitted to provide a single sign-on service, there are also WordPress SSO plugins that allow people to log in with CAS, LDAP, Google, etc. So you might be able to handle the fourth scenario that way, and not have to custom code anything you would have to continue to maintain yourself.

  • So if i do this as a PHP function instead of a JS Function? – Chad Dec 14 '17 at 20:44
  • Exactly, but since you can handle most of your scenarios through WP core login, that would be the most forward-compatible way to proceed. – WebElaine Dec 15 '17 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.