The idea with the layout of the table you are showing is to have 1: many users: openids.
Thus, no changes to the user table are required.
When someone logs in with OpenID, you check to see if that OpenID is in the openids table. If so, you have the user_id of the user and you are done.
Otherwise, create a new user (without username and password) and insert the table (openid, user_id) into the openids table.
In the template, you can display any beautiful placeholder (for example, their OP or something else), where the username for users whose username is empty will usually be displayed.
I hope you have already banned login with empty passwords, so there should not be any security problems there.
source share