Fixed wrong login_counter when using ldap auth

* Also I tried to make authenticate method more 'nice' ;-)