Sha256: 0b66b5c2384ac2458944f66bd75c840de37c1ec3823a5c9308d8f27422e4b7a3

Contents?: true

Size: 882 Bytes

Versions: 7

Compression:

Stored size: 882 Bytes

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 '/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 '/'
    else
        'Boohoo...'
    end
end

get '/congrats' do
    'Congrats!'
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arachni-0.4.6 spec/support/servers/plugins/autologin.rb
arachni-0.4.5.2 spec/support/servers/plugins/autologin.rb
arachni-0.4.5.1 spec/support/servers/plugins/autologin.rb
arachni-0.4.5 spec/support/servers/plugins/autologin.rb
arachni-0.4.4 spec/support/servers/plugins/autologin.rb
arachni-0.4.3.2 spec/support/servers/plugins/autologin.rb
arachni-0.4.3.1 spec/support/servers/plugins/autologin.rb