Monday, March 30, 2009
Facebook Connect Login Logic
// this condition actually just looks at whether the "user" cookie is set, which seems to
// indicate that they will all be set; it doesn't do the signature verification yet
if( the FC cookies are set )
if( there is a valid logged-in MP session )
if( the Facebook user and MP user are linked in the database )
// just continue loading the page; we haven't checked the FC cookie signature,
// but that should be fine: the user has proven that they are the MP user by
// by having the session, and the link in the database proves that that user
// was authenticated as the linked Facebook user at some point.
else
if( !the Facebook cookies signature checks out )
// perhaps the cookies were tampered with; I don't worry too much about handling
// this case nicely
clear the FC cookies and redirect back to the front page
else
if( the MP user is linked to any Facebook user in the database )
// this is a strange case that should be very rare; usually, the javascript will probably
// prevent this; just switch the user to the Facebook user, since that puts us into a
// known state and seems reasonable
log the user out of MP
log the user into MP as the user linked to the Facebook user
else
if( the Facebook user is linked to any MP user in the database )
// perhaps the user apparently has two Facebook accounts? this redirects them to
// a page that allows them to log out of Facebook only (and stay logged into MP)
// or to log out of MP and log back in as the MP user linked to their Facebook
// account; if they choose the first option, it forwards to a page that executes
// this javascript:
// FB.ensureInit ( function () { FB.Connect.logoutAndRedirect('/'); } );
// The ensureInit() is important, since FB.init() runs asynchronously and method
// calls that occur before it finishes won't run properly. Unfortunately,
// logoutAndRedirect() shows the user a dialog box that says that they're logging
// out of "this site and Facebook", which is not actually true, but I don't think
// you can control that.
redirect to a special page to handle this case
else
// automatically link the users (normally, this state will have been the result
// of clicking the "connect accounts" link)
link the MP user with the Facebook user in the database
redirect the user to a user explaining the new account and asking them to select
a username
else
if( !the Facebook cookies signature checks out )
clear the FC cookies and redirect back to the front page
else
if( the Facebook user is linked to any MP user in the database )
// if the accounts are linked, then the user has already proven that the person
// authenticated by Facebook is the same person with the MP account; this is
// typically the result of the user clicking the "login with Facebook" link
log the user into MP as the user linked to the Facebook user
else
// User probably just clicked "login with Facebook" and they don't already have an MP
// account. Alternatively, I could have performed the automatic account creation in
// response to a post to the Post-Authorize URL, but doing it here seems just as well,
// and this way I don't have to remember in the database whether the user has had
// a chance to change their username.
create an MP account for the Facebook user
call the Facebook API to get the user's real name, which is used as their initial userame
(modify the username to avoid collisions with existing)
log the user into MP as the new user
redirect to a page explaining what just happened and prompting them to change their
username if desired
else
// at this point, the user might be logged into MP or might not
if( logged into MP and that user is linked to a Facebook user in the database )
// this might be the result of stale cookies; when the user is connected to a Facebook user,
// then they need to use Facebook authentication, so log them out and let them try again
log the user out of MP
This is what a website has to do if it wants to use Facebook Connect to associate FB users with it's own users. It's far from ideal as you might guess even if you can't read pseudo code.
Posted via web from CyberBilly
Sunday, March 29, 2009
Saturday, March 28, 2009
Tuesday, March 24, 2009
Monday, March 16, 2009
Computer Furniture | Computer Workstations | Lcd/Plasma Cart - Black - 239192BK - GlobalIndustrial.com
I've been dreaming of something just like this. I'm tired of the television being the immovable center of attention in my living room. A cart like this would allow me to not only treat the television more like a large screen computer and allow me to move it around the room to best serve whoever is using it at the time.
Posted via web from CyberBilly
Thursday, March 12, 2009
Mansfield Teacher Busted For Shoplifting
A Mansfield teacher has been busted for shoplifting. Police say Deborah Ludlow was caught trying to steal from Kohl's department store in Fort Smith Wednesday. Cops say she stuffed some clothes, and even a couple of rugs, into her purse and tried to make a break for it. Ludlow now faces misdemeanor shoplifting charges.
Ms Ludlow was my High School English teacher. Apparently she got caught again recently. Gotta say she always was one of the cooler teachers I had, but it sounds like I could have taught her a thing or two back then. Never steal anything that doesn't fit in your pockets Ms L.
Posted via web from CyberBilly
Wednesday, March 11, 2009
The Decemberists - The Hazards of Love
Download, listen, and be warned. Then go buy a ticket for their upcoming tour you music pirating freeloader!
Posted via web from CyberBilly
Sunday, March 08, 2009
Friday, March 06, 2009
Toxoplasmosis - Wikipedia, the free encyclopedia
Toxoplasma is one of a number of parasites that may alter their host's behaviour as a part of their life cycle.[15] The behaviors observed, if caused by the parasite, are likely due to infection and low-grade encephalitis, which is marked by the presence of cysts in the brain, which may produce or induce production of a neurotransmitter, possibly dopamine,[16] therefore acting similarly to dopamine reuptake inhibitor type antidepressants and stimulants.
Correlations have been found between latent Toxoplasma infections and various characteristics:[17]
I suddenly want to wash my hands
Posted via web from CyberBilly
We are The Cyclists - Cyclelicious
Okay funny but...
Roads are mainly paid for by taxes on commercial diesel. Why? because semi-trucks cause more wear to the road. Why? because they weigh tons. Ever seen a bicycle lane that was concave at a redlight from the weight of the idling bicycles? If bicycles were the only vehicles roads would cost less to build and maintain. Leave the heavy cargo for the rails.
Next, in all my years of riding on sidewalks, and running red lights I've never ran over a dog or caused an accident, but I've done both of those things in a car.
Finally, carbon fiber and lycra shorts are for choads.
Posted via web from CyberBilly