def update_user_auth_stat(self, user, success=True):
        """
        Update user authentication stats upon successful/unsuccessful
        authentication attempts.

        :param user:
            The identified (but possibly not successfully authenticated) user
            model
        :param success:
        :type success: bool or None
            Defaults to true, if true increments login_count, updates
            last_login, and resets fail_login_count to 0, if false increments
            fail_login_count on user model.
        """
        if not user.login_count:
            user.login_count = 0
        if not user.fail_login_count:
            user.fail_login_count = 0
        if success:
            user.login_count += 1
            user.last_login = datetime.datetime.now()
            user.fail_login_count = 0
        else:
            user.fail_login_count += 1
        self.update_user(user)

        Update user authentication stats upon successful/unsuccessful
        authentication attempts.

        :param user:
            The identified (but possibly not successfully authenticated) user
            model
        :param success:
        :type success: bool or None
            Defaults to true, if true increments login_count, updates
            last_login, and resets fail_login_count to 0, if false increments
            fail_login_count on user model.
        
flask_appbuilder/security/manager.py