added login and fix the registration