Added a named route for the home page.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@760 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/351/head
Jean-Philippe Lang 17 years ago
parent 042ef42da0
commit 650888c73b
  1. 12
      app/controllers/account_controller.rb
  2. 2
      app/views/layouts/base.rhtml
  3. 4
      config/routes.rb

@ -63,15 +63,15 @@ class AccountController < ApplicationController
cookies.delete :autologin
Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) if User.current.logged?
self.logged_user = nil
redirect_to :controller => 'welcome'
redirect_to home_url
end
# Enable user to choose a new password
def lost_password
redirect_to :controller => 'welcome' and return unless Setting.lost_password?
redirect_to(home_url) && return unless Setting.lost_password?
if params[:token]
@token = Token.find_by_action_and_value("recovery", params[:token])
redirect_to :controller => 'welcome' and return unless @token and !@token.expired?
redirect_to(home_url) && return unless @token and !@token.expired?
@user = @token.user
if request.post?
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
@ -105,12 +105,12 @@ class AccountController < ApplicationController
# User self-registration
def register
redirect_to :controller => 'welcome' and return unless Setting.self_registration?
redirect_to(home_url) && return unless Setting.self_registration?
if params[:token]
token = Token.find_by_action_and_value("register", params[:token])
redirect_to :controller => 'welcome' and return unless token and !token.expired?
redirect_to(home_url) && return unless token and !token.expired?
user = token.user
redirect_to :controller => 'welcome' and return unless user.status == User::STATUS_REGISTERED
redirect_to(home_url) && return unless user.status == User::STATUS_REGISTERED
user.status = User::STATUS_ACTIVE
if user.save
token.destroy

@ -30,7 +30,7 @@
<%= link_to(l(:label_register), :controller => 'account',:action => 'register') if Setting.self_registration? %>
<% end %>
</div>
<%= link_to l(:label_home), { :controller => 'welcome' } %>
<%= link_to l(:label_home), home_url %>
<%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'} if User.current.logged? %>
<%= link_to l(:label_project_plural), { :controller => 'projects' } %>
<%= link_to l(:label_administration), { :controller => 'admin' } if User.current.admin? %>

@ -6,9 +6,7 @@ ActionController::Routing::Routes.draw do |map|
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# You can have the root of your site routed by hooking up ''
# -- just remember to delete public/index.html.
map.connect '', :controller => "welcome"
map.home '', :controller => 'welcome'
map.connect 'wiki/:id/:page/:action', :controller => 'wiki', :page => nil
map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'

Loading…
Cancel
Save