<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -51,7 +51,7 @@ module Merb::Authentication::Mixins
     def _set_return_to
       unless request.exceptions.blank?
         session[:return_to] ||= []
-        session[:return_to] &lt;&lt; request.uri
+        session[:return_to] &lt;&lt; &quot;#{Merb::Config[:path_prefix]}#{request.uri}&quot;
         session[:return_to]
       end
     end</diff>
      <filename>merb-auth/merb-auth-more/lib/merb-auth-more/mixins/redirect_back.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,44 @@
 require File.join(File.dirname(__FILE__), &quot;..&quot;, 'spec_helper.rb')
 require File.join(File.expand_path(File.dirname(__FILE__)), &quot;..&quot;, &quot;..&quot; ,&quot;lib&quot;, &quot;merb-auth-more&quot;, &quot;mixins&quot;, &quot;redirect_back&quot;)
 
+
+describe &quot;every call to redirect_back&quot;, :shared =&gt; true do
+
+  it &quot;should set the return_to in the session when sent to the exceptions controller from a failed login&quot; do
+    r = request(&quot;/go_back&quot;)
+    r.status.should == Merb::Controller::Unauthenticated.status
+    r2 = login
+    r2.should redirect_to(@return_to_after_failed_login)
+  end
+
+  it  &quot;should not set the return_to in the session when deliberately going to unauthenticated&quot; do
+    r = login
+    r.should redirect_to(&quot;/&quot;)
+  end
+
+  it &quot;should still redirect to the original even if it's failed many times&quot; do
+    request(&quot;/go_back&quot;)
+    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
+    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
+    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
+    r = login
+    r.should redirect_to(@return_to_after_failed_login)
+  end
+
+  it &quot;should not redirect back to a previous redirect back after being logged out&quot; do
+    request(&quot;/go_back&quot;)
+    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
+    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
+    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
+    r = login
+    r.should redirect_to(@return_to_after_failed_login)
+    request(&quot;/logout&quot;, :method =&gt; &quot;delete&quot;)
+    r = login
+    r.should redirect_to(&quot;/&quot;)
+  end
+
+end
+
 describe &quot;redirect_back&quot; do
   
   before(:all) do
@@ -60,38 +98,21 @@ describe &quot;redirect_back&quot; do
   def login
     request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; true})
   end
-  
-  it &quot;should set the return_to in the session when sent to the exceptions controller from a failed login&quot; do
-    r = request(&quot;/go_back&quot;) 
-    r.status.should == Merb::Controller::Unauthenticated.status
-    r2 = login
-    r2.should redirect_to(&quot;/go_back&quot;)
-  end
-  
-  it  &quot;should not set the return_to in the session when deliberately going to unauthenticated&quot; do
-    r = login
-    r.should redirect_to(&quot;/&quot;)
-  end
-  
-  it &quot;should still redirect to the original even if it's failed many times&quot; do
-    request(&quot;/go_back&quot;)
-    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
-    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
-    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
-    r = login
-    r.should redirect_to(&quot;/go_back&quot;)
+
+  describe &quot;without Merb::Config[:path_prefix]&quot; do
+    before(:all) do
+      Merb::Config[:path_prefix] = nil
+      @return_to_after_failed_login = '/go_back'
+    end
+    it_should_behave_like 'every call to redirect_back'
   end
 
-  it &quot;should not redirect back to a previous redirect back after being logged out&quot; do
-    request(&quot;/go_back&quot;)
-    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
-    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
-    request(&quot;/login&quot;, :method =&gt; &quot;put&quot;, :params =&gt; {:pass_auth =&gt; false})
-    r = login
-    r.should redirect_to(&quot;/go_back&quot;)
-    request(&quot;/logout&quot;, :method =&gt; &quot;delete&quot;)
-    r = login
-    r.should redirect_to(&quot;/&quot;)
+  describe &quot;without Merb::Config[:path_prefix]&quot; do
+    before(:all) do
+      Merb::Config[:path_prefix] = '/myapp'
+      @return_to_after_failed_login = '/myapp/go_back'
+    end
+    it_should_behave_like 'every call to redirect_back'
   end
   
 end
\ No newline at end of file</diff>
      <filename>merb-auth/merb-auth-more/spec/mixins/redirect_back_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b0bd28095274099f0caab548cd0e090a916219cb</id>
    </parent>
  </parents>
  <author>
    <name>snusnu</name>
    <email>gamsnjaga@gmail.com</email>
  </author>
  <url>http://github.com/wycats/merb/commit/a0fb0bf03c2e8be90b782bc4616c626e47440005</url>
  <id>a0fb0bf03c2e8be90b782bc4616c626e47440005</id>
  <committed-date>2009-10-26T21:50:03-07:00</committed-date>
  <authored-date>2009-10-26T21:05:11-07:00</authored-date>
  <message>[merb-auth-more] #redirect_back respects Merb::Config[:path_prefix]

[#1105 state:resolved]</message>
  <tree>17f74e843a211d8b3a8d44534d877ba8b04b44e2</tree>
  <committer>
    <name>snusnu</name>
    <email>gamsnjaga@gmail.com</email>
  </committer>
</commit>
