summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-08-22 11:25:06 +0200
committermguetlein <martin.guetlein@gmail.com>2011-08-22 11:25:06 +0200
commitb41552185b21f706e7f507020925f3253c38321d (patch)
treeb33eb0b2c5eab79bbf831b75511a61ad089a0e61
parent282ca3f261897df3324ecdf7040d1a7b1c37edd9 (diff)
unify cookies
-rw-r--r--application.rb5
-rw-r--r--helper.rb30
2 files changed, 3 insertions, 32 deletions
diff --git a/application.rb b/application.rb
index a60e597..ac19da5 100644
--- a/application.rb
+++ b/application.rb
@@ -9,8 +9,9 @@ require 'ftools'
require File.join(File.dirname(__FILE__),'model.rb')
require File.join(File.dirname(__FILE__),'helper.rb')
-use Rack::Session::Cookie, :expire_after => 28800,
- :secret => "ui6vaiNi-change_me"
+#moved to wrapper->environment
+#use Rack::Session::Cookie, :expire_after => 28800,
+# :secret => "ui6vaiNi-change_me"
use Rack::Flash
set :lock, true
diff --git a/helper.rb b/helper.rb
index 698fd3e..80707c3 100644
--- a/helper.rb
+++ b/helper.rb
@@ -1,35 +1,5 @@
helpers do
- def login(username, password)
- logout
- session[:subjectid] = OpenTox::Authorization.authenticate(username, password)
- #LOGGER.debug "ToxCreate login user #{username} with subjectid: " + session[:subjectid].to_s
- if session[:subjectid] != nil
- session[:username] = username
- return true
- else
- session[:username] = ""
- return false
- end
- end
-
- def logout
- if session[:subjectid] != nil
- session[:subjectid] = nil
- session[:username] = ""
- return true
- end
- return false
- end
-
- def logged_in()
- return true if !AA_SERVER
- if session[:subjectid] != nil
- return OpenTox::Authorization.is_token_valid(session[:subjectid])
- end
- return false
- end
-
def is_authorized(uri, action)
if OpenTox::Authorization.server && session[:subjectid] != nil
return OpenTox::Authorization.authorized?(uri, action, session[:subjectid])