Module: Superbot::Cloud::Web

Defined in:
lib/superbot/cloud/web.rb

Class Method Summary collapse

Class Method Details

.registered(sinatra) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/superbot/cloud/web.rb', line 6

def self.registered(sinatra)
  sinatra.get "/login" do
    credentials = request.params.slice('username', 'email', 'token', 'organization')
    Superbot::Cloud.save_credentials(credentials)
    puts "Logged in as #{credentials[:username]} (#{credentials[:email]})"
    redirect "#{Superbot::Cloud::LOGIN_URI}/success"
  end

  sinatra.after "/login" do
    sleep 1
    sinatra.quit!
  end
end