You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: login.rb
    path of file: ./repos/metasploit-framework/lib/msf/core/exploit/remote/http/gitea
    
    the code of the file until where you have to start completion: # -*- coding: binary -*-

module Msf::Exploit::Remote::HTTP::Gitea::Login
  # performs a gitea login
  #
  # @param user [String] Username
  # @param pass [String] Password
  # @param timeout [Integer] The maximum number of seconds to wait before the
  #   request times out
  # @raise 
    
  def gitea_login(user, pass, timeout = 20)
    res = send_request_cgi({
      'uri' => gitea_url_login,
      'keep_cookies' => true
    }, timeout)
    return nil unless res

    csrf = gitea_get_csrf(res)
    raise Msf::Exploit::Remote::HTTP::Gitea::Error::CsrfError.new unless csrf

    res = send_request_cgi(
      'method' => 'POST',
      'uri' => gitea_url_login,
      'vars_post' => gitea_helper_login_post_data(user, pass, csrf),
      'keep_cookies' => true
    )

    raise Msf::Exploit::Remote::HTTP::Gitea::Error::AuthenticationError.new if res&.code != 302

    store_valid_credential(user: user, private: pass)
    return res
  end