Auto login user after registration
Code cleanup and security update