Skip to content

Instantly share code, notes, and snippets.

Created August 12, 2014 21:43
Show Gist options
  • Save anonymous/2b10c35d914e335bf943 to your computer and use it in GitHub Desktop.
Save anonymous/2b10c35d914e335bf943 to your computer and use it in GitHub Desktop.
def call(env)
@req = Rack::Request.new(env)
case @req.path
when '/'
body = <<-HTML
<form action="/generate_certificate" method="post">
Username: <input type="text" name="username" /><br/>
Password: <input type="text" name="password" /><br/>
MAC Address: <input type="text" name="macaddress" /><br/>
***This data is not saved at any point on this system, it is passed directly into the appliance securely to generate a certificate, which will be emailed to you upon completion.***<br/>
<input type="submit" value="Generate Certificate" name="submit" />
</form>
HTML
return [200, {'Content-Type' => 'text/html'}, [body]]
when "/generate_certificate"
send_email
# if @req.post?
# return [200, {'Content-Type' => 'text/plain'},
# ["Your data has been processed and you should receive an email with your certificate shortly.:n",JSON.pretty_generate(@req.POST)]]
# end
puts @req.POST
end
[404, {}, ["not found oO"]]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment