Moved login functions to new login controller