Skip to content

Instantly share code, notes, and snippets.

@vtypal
Created January 12, 2010 14:10
Show Gist options
  • Save vtypal/275227 to your computer and use it in GitHub Desktop.
Save vtypal/275227 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'innate'
class Rpanel
Innate.node '/'
provide :html, :engine => :Etanni, :type => 'text/html'
def index(lang="en")
if request.post?
@user, @pass = request[ 'user', 'pass']
loginchk(@user,@pass)
end
%|
<?r unless session[:resu] ?>
#{flash[:error]}
<form action="/" method="post">
Username: <input type="text" name="user" /> <br />
Password: <input type="password" name="pass" />
<input type="submit" />
</form>
<?r else ?>
Username: #@user <br />
Password: #@pass <br />
Your session-key: #{session[:resu]} <br />
Your section characteristics <br />
key : #{Innate::Session.options[:key]} <br />
domain : #{Innate::Session.options[:domain]} <br />
#{a('logout', :logout)} <br />
<?r end ?>
|
end
def logout
session.clear
end
private
def loginchk(u,p)
if u == "myusername" && p=="mypassword"
session[:resu] = "221" + u + "44(____33321av_-we"
else
flash[:error]="Username & Password do not match"
end
end
end
mode = :dev
Innate::Session.options[:key]="rka"
Innate::Session.options[:domain]="rk21.lan"
#Innate::Session.options[:ttl or expires see session.rb on source. 30 days.
Innate.options.adapter.port = 7000
Innate.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment