Hey @pmartinezc,
Sorry for being so slow to reply. I’m putting a new kitchen in at home which is consuming a lot of time at the moment 😛
If I turn Migrate Mode On –> I can log in with my local Admin user and external users from a SQL Server database can log in too. But if an external user changes his password it´s not updated in the local WordPress database, resulting in login errors (because it’s checking the local user first and the stored password is the old one).
This sounds right. This is the designed behaviour as the idea of the migration was that users are no longer using the old database and are only being migrated over to the new site that you’re using. It essentially makes the new WordPress database the center of truth but if the user does not currently exist it will try and retrieve the data from the database you’re trying to migrate from. Hope that makes sense 😛
If I turn Migrate Mode off –> External users can log in and if they happen to change their password it´s successfully updated in the local WordPress database (I guess it might update any other field such as name or email). But the problem here is: my local Admin user can´t log in, so I lose entirely the website´s control. It seems like only the external database was checked and the local database was ignored.
This does not sound like the expected behaviour. Unless you have ticked the ‘Disable Local Login’ box.
“Tick this box if you want to disable the login attempt with the WordPress Database if the external login fails. This will only take effect if External Login is enabled.”
Can you check this and if this is not the issue I’ll see if I can replicate the problem locally.
Thanks @pmartinezc, and apologies again for the delay in getting back to you!
Tom
Thread Starter
Pablo
(@pmartinezc)
Hi! Thanks for your reply
I’ve got this configuration (WordPress 5.2.3 + MySQL):
———————————————————-
Functionality Settings
-Enable External Login: On
-Migration Mode: not checked
-Redirect after Authentication: local + URL
-Disable Local Login: not checked
Database Configuration
My external BD settings with SQL Server, test Connection button working and authenticating well.
Password Hashing
md5, no salting
Database Table Mapping
I’ve got filled the field mapping, works okay
Role Field name and Multiple Roles per user: not checked
Role Settings
Unspecified Role: Author (because that´s what I want by default for external users).
Exclude Users
Not checked
———————————————————
No matter if I check or uncheck ‘Disable Local Login’ with ‘Enable External Users’ turned On, my local admin user won’t authenticate until Migration Mode is On.
By the way, the website is under a WordPress network with more blogs (multisite), ¿that might be the problem? ‘Enable External Login’ is not checked for the network´s default blog (that way I can log in to the network with no issues, otherwise is the same story, if migration mode not checked –> local login fails).
I hope these details help finding the solution
Thank you!
Hey @pmartinezc,
Apologies for the delay again. Life’s busy at the moment 😛
It sounds like you’ve got all the right boxes ticked. However I have not made the plugin compatible with multi-site (nor have I ever used a multi-site WordPress setup before 😬).
I’m adding this feature to the top of my list of to dos and I will leave this conversation open so that I can update you when progress is made. Unfortunately this is not something I’m going to have time to look at for 6 weeks or so.
In the meantime, you’re welcome to look into the plugin and see if you can build compatibility yourself. There is a git repo for the plugin and I welcome pull requests. 😊
Sorry I can’t help you sooner but I just don’t have the capacity to do it at the moment.
Tom
Thread Starter
Pablo
(@pmartinezc)
Hi! Thank you for your answer.
I wish I could fix it myself but I lack the skills.
By the way, I tried the ‘external login’ plugin with a regular WordPress Blog, no multisite, version 5.2.3. Same issue here, if Migration Mode is not checked my local Admin user won’t authenticate, it says user/pass invalid.
So I guess this narrows it down to a single-site type of problem. Right?
It has maybe something to do with the WordPress Version?
If you need in-depth details about my configuration don’t hesitate to contact me.
Thanks again for your help 🙂
Hey @pmartinezc,
Really sorry for the delayed reply.
I’ve just attempted to replicate this bug for you.
I used the following passwords for testing:
Starting password:
– Plain text (password1)
– Hash ($P$BJkC.Isz7DOxteQmKpKYfr26Qds.sT/)
Modified password:
– Plain text (passwordnew)
– Hash ($1$zo2d0s91$HQ5fN81Sbb36RoY97e2zx.)
Steps I went through:
- deactivate migration mode and set both my external db password and WordPress password for my user to password1’s hash
- change password on wordpress database to passwordnew hash
- try to login with new password
- login fails
- login with password1
- login success
- observe wordpress password has changed back to password1 hash
- activate migration mode
- change wordpress password to passwordnew hash in database
- try logging in with old password
- login failed
- try logging in with new password
- login succeeds
If you go through this process which step does it fail on?
Thread Starter
Pablo
(@pmartinezc)
Hi! No worries, thank you very much for your answer.
It fails on the very beginning, first I pasted your password1 hash for my local user in the local MySQL DB.
-Enable external Login OFF and Migration Mode OFF –> local login works (pass: password1 with your hash)
-Enable external Login ON and Migration Mode OFF –> local login fails
Now I try to log in after changing the password to the new one, pasting passwordnew hash for my local user in the local MySQL DB:
-Enable external Login ON and Migration Mode OFF + typing passwordnew –> local login fails
-Enable external Login ON and Migration Mode OFF + typing password1 (the previous one) –> local login fails
-Enable external Login ON and Migration Mode ON + whatever password I paste on the DB –> local login works
So, basically, with External Login ON I always need Migration Mode ON in order to Log in with my local user, but I lose the sync from the external DB to the local DB if anyone happens to change a field, and that’s quite problematic, specially if users change their passwords/emails and lose access to the site.
I hope this can be fixed, this might happen to other WordPress users too.
Thanks again for your help!!
Thread Starter
Pablo
(@pmartinezc)
By the way, for this test I didn’t use the external user at all, because admin local user has letters for username and the external one consist off an ID with numbers, totally different. They are different users. Local should be admin (via WP local DB), external SQL Server user should be author by default (via your plugin).
I mean, I didn’t quite understand why change both local and external user’s pass when tests are using only the local user, which has an unique username (the external one is not used on your steps). On step 1 I don’t know which user you were referring to, so I assumed my local admin user, the one I’m having problems with.
Sorry If I misunderstood something, just wanted to clarify that and it might help with the debugging.
Thanks!