added login and registration logic