def login(username, password)
      # Save the assertion value while trying to log in, because otherwise the assertion will prevent us from logging in
      assertion_value = @assertion.clone
      @assertion = nil

      params = {
        action: 'login',
        lgname: username,
        lgpassword: password,
        lgtoken: get_token('login')
      }

      response = post(params)

      @assertion = assertion_value

      result = response['login']['result']

      if result == 'Success'
        @name = response['login']['lgusername']
        @logged_in = true
        return true
      end

      raise MediaWiki::Butt::AuthenticationError.new(result)
    end
def login(username, password)
      # Save the assertion value while trying to log in, because otherwise the assertion will prevent us from logging in
      assertion_value = @assertion.clone
      @assertion = nil

      params = {
        action: 'login',
        lgname: username,
        lgpassword: password,
        lgtoken: get_token('login')
      }

      response = post(params)

      @assertion = assertion_value

      result = response['login']['result']

      if result == 'Success'
        @name = response['login']['lgusername']
        @logged_in = true
        return true
      end

      raise MediaWiki::Butt::AuthenticationError.new(result)
    end
Logs the user into the wiki. This is generally required for editing and getting restricted data.
 @param username [String] The username
 @param password [String] The password
 @see https://www.mediawiki.org/wiki/API:Login MediaWiki Login API Docs
 @since 0.1.0
 @raise [AuthenticationError]
 @return [Boolean] True if the login was successful.