summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-07 17:45:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-07 17:45:12 +0000
commit986ffb24343877a76b505363aa2dc836e16465f5 (patch)
treef7ad269a7abd67dbfa994958c2e536a768e1a7cd
parentefc6abea07a7a437b0a68cfb297b53fbe6d9de2b (diff)
downloadredmine-986ffb24343877a76b505363aa2dc836e16465f5.tar.gz
redmine-986ffb24343877a76b505363aa2dc836e16465f5.zip
Use named routes.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9940 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/account_controller.rb10
-rw-r--r--app/views/account/login.html.erb4
-rw-r--r--app/views/account/lost_password.html.erb16
-rw-r--r--app/views/account/register.html.erb2
-rw-r--r--config/routes.rb4
-rw-r--r--lib/redmine.rb2
6 files changed, 19 insertions, 19 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 5c4ecaf40..ea3dcb1ae 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -70,7 +70,7 @@ class AccountController < ApplicationController
if token.save
Mailer.lost_password(token).deliver
flash[:notice] = l(:notice_account_lost_email_sent)
- redirect_to :action => 'login'
+ redirect_to signin_path
return
end
end
@@ -129,7 +129,7 @@ class AccountController < ApplicationController
token.destroy
flash[:notice] = l(:notice_account_activated)
end
- redirect_to :action => 'login'
+ redirect_to signin_path
end
private
@@ -224,7 +224,7 @@ class AccountController < ApplicationController
def onthefly_creation_failed(user, auth_source_options = { })
@user = user
session[:auth_source_registration] = auth_source_options unless auth_source_options.empty?
- render :action => 'register'
+ render register_path
end
def invalid_credentials
@@ -240,7 +240,7 @@ class AccountController < ApplicationController
if user.save and token.save
Mailer.register(token).deliver
flash[:notice] = l(:notice_account_register_done)
- redirect_to :action => 'login'
+ redirect_to signin_path
else
yield if block_given?
end
@@ -277,6 +277,6 @@ class AccountController < ApplicationController
def account_pending
flash[:notice] = l(:notice_account_pending)
- redirect_to :action => 'login'
+ redirect_to signin_path
end
end
diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb
index 99eda9242..f2f7f74ed 100644
--- a/app/views/account/login.html.erb
+++ b/app/views/account/login.html.erb
@@ -1,6 +1,6 @@
<%= call_hook :view_account_login_top %>
<div id="login-form">
-<%= form_tag({:action=> "login"}) do %>
+<%= form_tag(signin_path) do %>
<%= back_url_hidden_field_tag %>
<table>
<tr>
@@ -28,7 +28,7 @@
<tr>
<td align="left">
<% if Setting.lost_password? %>
- <%= link_to l(:label_password_lost), :controller => 'account', :action => 'lost_password' %>
+ <%= link_to l(:label_password_lost), lost_password_path %>
<% end %>
</td>
<td align="right">
diff --git a/app/views/account/lost_password.html.erb b/app/views/account/lost_password.html.erb
index 44f851475..19df8d9a9 100644
--- a/app/views/account/lost_password.html.erb
+++ b/app/views/account/lost_password.html.erb
@@ -1,11 +1,11 @@
<h2><%=l(:label_password_lost)%></h2>
-<div class="box">
-<%= form_tag({:action=> "lost_password"}, :class => "tabular") do %>
-
-<p><label for="mail"><%=l(:field_mail)%> <span class="required">*</span></label>
-<%= text_field_tag 'mail', nil, :size => 40 %>
-<%= submit_tag l(:button_submit) %></p>
-
+<%= form_tag(lost_password_path) do %>
+ <div class="box tabular">
+ <p>
+ <label for="mail"><%=l(:field_mail)%> <span class="required">*</span></label>
+ <%= text_field_tag 'mail', nil, :size => 40 %>
+ <%= submit_tag l(:button_submit) %>
+ </p>
+ </div>
<% end %>
-</div>
diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb
index 7e44e123b..e8e8098fe 100644
--- a/app/views/account/register.html.erb
+++ b/app/views/account/register.html.erb
@@ -1,6 +1,6 @@
<h2><%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h2>
-<%= labelled_form_for @user, :url => {:action => 'register'} do |f| %>
+<%= labelled_form_for @user, :url => register_path do |f| %>
<%= error_messages_for 'user' %>
<div class="box tabular">
diff --git a/config/routes.rb b/config/routes.rb
index b4c792b99..e3ed8859a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -20,8 +20,8 @@ RedmineApp::Application.routes.draw do
match 'login', :to => 'account#login', :as => 'signin'
match 'logout', :to => 'account#logout', :as => 'signout'
- match 'account/register', :to => 'account#register', :via => [:get, :post]
- match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post]
+ match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
+ match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
match 'account/activate', :to => 'account#activate', :via => :get
match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news'
diff --git a/lib/redmine.rb b/lib/redmine.rb
index 1b9be57f5..0459dcc50 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -162,7 +162,7 @@ end
Redmine::MenuManager.map :account_menu do |menu|
menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? }
- menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
+ menu.push :register, :register_path, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }
menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? }
end