Skip to content

Commit

Permalink
Merge pull request #6 from Besermenji/vb/sinatra-auth
Browse files Browse the repository at this point in the history
Sinatra authentication added
  • Loading branch information
Besermenji authored Jul 4, 2016
2 parents 960814a + 20f7fb5 commit c8c5f1c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions report_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@


class ReportGenerator < Sinatra::Base

use Rack::Auth::Basic, "Restricted Area" do |username, password|

if ENV['RACK_ENV'] == 'production'
@username = ENV["SINATRA_USERNAME"]
@password = ENV["SINATRA_PASSWORD"]
else
@username = "admin"
@password = "admin"
end

username == @username and password == @password
end

post '/kif/?' do
@kif_info = JSON.parse(params["data"])
Expand Down

0 comments on commit c8c5f1c

Please sign in to comment.