Refactoring user authentication on counter reset