Closed will-clark closed 10 years ago
Created a User.getDisplay() which checks first to see if a name is set and then falls back to username if not set
In the case of Facebook Users, the name from Facebook is automatically populated into the User name field. The name field will also be updated over time if the user changes their name on Facebook.
When a user signs into the website via FB, we still need a User object created for our site. We can use the Facebook ID to generate a pseudo unique Username for us.
Since our Sign Up page won't allow numeric only Usernames, I propose we can use a prefix of "!FBNNNNNNN" for these User objects that are created via Facebook Login. Each and every time they login, the Facebook ID will be used to lookup a User. The "!FB" prefix is used to prevent a local-based User Username from ever colliding with a facebook-based User Username. The prefix also serves as security to measure to prevent users from attempting to login as these potentially less secure accounts via the Login Form. The Login Form will be coded such at any username beginning with "!" will be rejected.
Since we re-use the Username field to hold our Facebook ID information, we'll need another field to use as the Users ID on our site. I actually think this is the better design anyway. If a local-based User later decides their Username of "Winacoholic2008" is no longer great, they have way to change their appearance to the Another Glass audience without losing their data by signing up for a new account.
One downside of this design is that this may prevent our ability to handle the situation of a User losing access to their FB credentials and wanting to reclaim their User data on our site.
Summary