login function added to usermodel