Skip to content

Instantly share code, notes, and snippets.

@ajuckel

ajuckel/app.rb Secret

Created April 16, 2012 16:03
Show Gist options
  • Save ajuckel/e71006e05d75796ddd8b to your computer and use it in GitHub Desktop.
Save ajuckel/e71006e05d75796ddd8b to your computer and use it in GitHub Desktop.
Sinatra sample
require 'sinatra'
get '/' do
erb :index
end
post '/' do
session = login(params[:username], params[:password])
erb :index
end
def login(username, password)
@username = username
@password = password
end
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<% if @username && @password %>
<ul>
<li>Username: <%= @username %></li>
<li>Password: <%= @password %></li>
</ul>
<% end %>
<form action="/" method="post">
<input type="text" label="username" name="username" />
<input type="password" label="password" name="password" />
<input type="submit" />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment