Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (18 sloc) 380 Bytes
require 'sinatra'
class TestSinatraApp < Sinatra::Base
enable :sessions
get '/login' do
body "Please log in"
end
post '/login' do
session[:user_email] = params[:user_email]
redirect to('/profile')
end
get '/profile' do
if user_email = session[:user_email]
body "Welcome, #{user_email}!"
else
redirect to('/login')
end
end
end
Jump to Line
Something went wrong with that request. Please try again.