[Hiki-cvs 1464] [1012] now can login/logout when using Rack

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2009年 8月 27日 (木) 23:59:32 JST


Revision: 1012
          http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=1012
Author:   okkez
Date:     2009-08-27 23:59:32 +0900 (Thu, 27 Aug 2009)

Log Message:
-----------
now can login/logout when using Rack

Modified Paths:
--------------
    hiki/branches/rack/hiki/command.rb
    hiki/branches/rack/hiki/util.rb

Modified: hiki/branches/rack/hiki/command.rb
===================================================================
--- hiki/branches/rack/hiki/command.rb	2009-08-27 14:59:27 UTC (rev 1011)
+++ hiki/branches/rack/hiki/command.rb	2009-08-27 14:59:32 UTC (rev 1012)
@@ -496,10 +496,12 @@
           session.user =****@plugi*****
           session.save
           if page && !page.empty?
-            return redirect(@cgi, @conf.base_url +****@plugi*****_url( page ), session_cookie( session.session_id ))
+            url =****@conf*****_url +****@plugi*****_url( page )
           else
-            return redirect(@cgi, @conf.index_url, session_cookie( session.session_id ))
+            url =****@conf*****_url
           end
+          cookies = [session_cookie(session.session_id)]
+          return redirect(@cgi, url, cookies)
         else
           msg_login_result =****@conf*****_login_failure
           status = '403 Forbidden'

Modified: hiki/branches/rack/hiki/util.rb
===================================================================
--- hiki/branches/rack/hiki/util.rb	2009-08-27 14:59:27 UTC (rev 1011)
+++ hiki/branches/rack/hiki/util.rb	2009-08-27 14:59:32 UTC (rev 1012)
@@ -152,7 +152,16 @@
                </head>
                <body>Wait or <a href="#{url}">Click here!</a></body>
                </html>]
-      Hiki::Response.new(body, 200, header)
+      response = Hiki::Response.new(body, 200, header)
+      if Object.const_defined?(:Rack)
+        cookies = response.header.delete('cookie')
+        if cookies
+          cookies.each do |cookie|
+            response.set_cookie(cookie.name, cookie.value)
+          end
+        end
+      end
+      response
     end
 
     def sendmail(subject, body)




Hiki-cvs メーリングリストの案内
アーカイブの一覧に戻る