24 lines
715 B
Ruby
24 lines
715 B
Ruby
require 'net/https'
|
|
require 'uri'
|
|
|
|
class VCN
|
|
include Cinch::Plugin
|
|
|
|
match "vcn"
|
|
|
|
def execute(m)
|
|
base_uri = "https://webmail.ventuordici.org/toolz/token"
|
|
uri = URI.parse(base_uri+"/generate")
|
|
Net::HTTP.start(uri.host, uri.port,
|
|
:use_ssl => uri.scheme == 'https',
|
|
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|
|
|
|
|
request = Net::HTTP::Post.new(uri.request_uri)
|
|
request.set_form_data({"email" => ENV["ORTICHE_MAIL"], "password" => ENV["ORTICHE_PASS"], "type" => "vcn"})
|
|
response = https.request(request)
|
|
if response.body =~ /<span id='token'>(.*?)<\/span>/
|
|
m.reply base_uri+"/check/"+$1
|
|
end
|
|
end
|
|
end
|
|
end
|