Puts the similiar session-blocks into a method

Hey,
I changed this as I need to add some more session variables for my own features and this way I don't need to do this three times.

You wrote this on line 188:
// TODO: this block is same/similar to the one from login(), maybe we should put this in a method

So I think this is done. I didn't test the facebook login as I don't use it but it looks the same as the other login functions and those are working for me. Maybe someone else can test this with facebook log in.