us ending up on the right page afterwards.
end
def require_user
- redirect_to :controller => 'user', :action => 'login', :next_controller => controller_name, :next_action => action_name unless @user
+ redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri unless @user
end
def authorize(realm='Web Password', errormessage="Couldn't authenticate you")
if @user
list(@user, 'mine') unless @user.nil?
else
- redirect_to :controller => 'user', :action => 'login'
+ redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri
end
end
u.timeout = 1.day.from_now
u.save
session[:token] = u.token
- if params[:next_controller] and params[:next_action]
- redirect_to :controller => params[:next_controller], :action => params[:next_action]
+ if params[:referer]
+ redirect_to params[:referer]
else
redirect_to :controller => 'site', :action => 'index'
end
end
end
session[:token] = nil
- if params[:next_controller] and params[:next_action]
- redirect_to :controller => params[:next_controller], :action => params[:next_action]
+ if params[:referer]
+ redirect_to params[:referer]
else
redirect_to :controller => 'site', :action => 'index'
end
<span id="greeting">
<% if @user %>
Welcome, <%= link_to @user.display_name, {:controller => 'user', :action => 'view', :display_name => @user.display_name}, {:id => 'loginanchor'}%> |
- <%= link_to 'logout', {:controller => 'user', :action => 'logout', :next_controller => @controller.controller_name, :next_action => @controller.action_name}, {:id => 'loginanchor'}%>
+ <%= link_to 'logout', {:controller => 'user', :action => 'logout', :referer => request.request_uri}, {:id => 'loginanchor'}%>
<% else %>
- <%= link_to 'log in', {:controller => 'user', :action => 'login', :next_controller => @controller.controller_name, :next_action => @controller.action_name}, {:id => 'loginanchor'}%> |
+ <%= link_to 'log in', {:controller => 'user', :action => 'login', :referer => request.request_uri}, {:id => 'loginanchor'}%> |
<%= link_to 'sign up', {:controller => 'user', :action => 'new'}, {:id => 'registeranchor'} %>
<% end %>
</span>
<br/><br/>
<% end %>
<span class="rsssmall"><a href="<%= url_for :controller => 'trace', :action => 'georss' %>"><img src="/images/RSS.gif" border="0"></a></span> |
-<% if @user %>
- <%= link_to 'See just your traces, or upload a trace', {:controller => 'trace', :action => 'mine'} %>
-<% else %>
- <%= link_to 'login', {:controller => 'user', :action => 'login', :next_controller => 'traces', :next_action => 'mine'} %> to upload a trace or see yours alone
-<% end %>
+<%= link_to 'See just your traces, or upload a trace', {:controller => 'trace', :action => 'mine'} %>
<% if @tag %>
| <%= link_to 'See all traces', {:controller => 'trace', :action => 'list'} %>
<% end %>
Please login or <%= link_to 'create an account', :controller => 'user', :action => 'new' %>.<br>
<% form_tag :action => 'login' do %>
+<%= hidden_field_tag('referer', params[:referer]) %>
<table>
<tr><td>email address:</td><td><%= text_field('user', 'email',{:size => 50, :maxlength => 255}) %></td></tr>
<tr><td>password:</td><td><%= password_field('user', 'password',{:size => 50, :maxlength => 255}) %></td></tr>
map.connect '/user/confirm', :controller => 'user', :action => 'confirm'
map.connect '/user/go_public', :controller => 'user', :action => 'go_public'
map.connect '/user/reset_password', :controller => 'user', :action => 'reset_password'
- map.connect '/user/login/:next_controller/:next_action', :controller => 'user', :action => 'login'
- map.connect '/user/logout/:next_controller/:next_action', :controller => 'user', :action => 'logout'
map.connect '/index.html', :controller => 'site', :action => 'index'
map.connect '/edit.html', :controller => 'site', :action => 'edit'
map.connect '/search.html', :controller => 'way_tag', :action => 'search'