20140406 login

I'm done, please review this before merge.