Sha256: abae3d12035b621beda4ad38ac4eb6ce2e45c955e75da8625381eaf0dee4f8f8

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

require 'sinatra'
require 'sinatra/contrib'

get '/' do
    cookies[:success] ||= false

    if cookies[:success] == 'true'
        <<-HTML
            <a href='/congrats'>Hi there logged-in user!</a>
        HTML
    else
        redirect '/login'
    end
end

get '/redirect/1' do
    redirect '/redirect/2'
end

get '/redirect/2' do
    redirect '/redirect/3'
end

get '/redirect/3' do
    redirect '/'
end

get '/login' do
    cookies[:preserve] = 'this'

    <<-HTML
        <form method='post' name='login_form' action="/login">
            <input name='username' value='' />
            <input name='password' type='password' value='' />
            <input name='token' type='hidden' value='secret!' />
        </form>
    HTML
end

post '/login' do
    if params['username'] == 'john' && params['password'] == 'doe' &&
        params['token'] == 'secret!' && cookies[:preserve] == 'this'
        cookies[:success] = true
        redirect '/redirect/1'
    else
        'Boohoo...'
    end
end

get '/congrats' do
    'Congrats!'
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
arachni-1.1 spec/support/servers/plugins/autologin.rb
arachni-1.0.6 spec/support/servers/plugins/autologin.rb
arachni-1.0.5 spec/support/servers/plugins/autologin.rb
arachni-1.0.4 spec/support/servers/plugins/autologin.rb
arachni-1.0.3 spec/support/servers/plugins/autologin.rb
arachni-1.0.2 spec/support/servers/plugins/autologin.rb
arachni-1.0.1 spec/support/servers/plugins/autologin.rb
arachni-1.0 spec/support/servers/plugins/autologin.rb
arachni-0.4.7 spec/support/servers/plugins/autologin.rb