working login function with BCrypt