created function for login
added model method to check login