Added a named route for the home page.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@760 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
042ef42da0
commit
650888c73b
|
@ -63,15 +63,15 @@ class AccountController < ApplicationController
|
||||||
cookies.delete :autologin
|
cookies.delete :autologin
|
||||||
Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) if User.current.logged?
|
Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) if User.current.logged?
|
||||||
self.logged_user = nil
|
self.logged_user = nil
|
||||||
redirect_to :controller => 'welcome'
|
redirect_to home_url
|
||||||
end
|
end
|
||||||
|
|
||||||
# Enable user to choose a new password
|
# Enable user to choose a new password
|
||||||
def lost_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]
|
if params[:token]
|
||||||
@token = Token.find_by_action_and_value("recovery", 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
|
@user = @token.user
|
||||||
if request.post?
|
if request.post?
|
||||||
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||||
|
@ -105,12 +105,12 @@ class AccountController < ApplicationController
|
||||||
|
|
||||||
# User self-registration
|
# User self-registration
|
||||||
def register
|
def register
|
||||||
redirect_to :controller => 'welcome' and return unless Setting.self_registration?
|
redirect_to(home_url) && return unless Setting.self_registration?
|
||||||
if params[:token]
|
if params[:token]
|
||||||
token = Token.find_by_action_and_value("register", 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
|
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
|
user.status = User::STATUS_ACTIVE
|
||||||
if user.save
|
if user.save
|
||||||
token.destroy
|
token.destroy
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<%= link_to(l(:label_register), :controller => 'account',:action => 'register') if Setting.self_registration? %>
|
<%= link_to(l(:label_register), :controller => 'account',:action => 'register') if Setting.self_registration? %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</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_my_page), { :controller => 'my', :action => 'page'} if User.current.logged? %>
|
||||||
<%= link_to l(:label_project_plural), { :controller => 'projects' } %>
|
<%= link_to l(:label_project_plural), { :controller => 'projects' } %>
|
||||||
<%= link_to l(:label_administration), { :controller => 'admin' } if User.current.admin? %>
|
<%= 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'
|
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
||||||
# Keep in mind you can assign values other than :controller and :action
|
# Keep in mind you can assign values other than :controller and :action
|
||||||
|
|
||||||
# You can have the root of your site routed by hooking up ''
|
map.home '', :controller => 'welcome'
|
||||||
# -- just remember to delete public/index.html.
|
|
||||||
map.connect '', :controller => "welcome"
|
|
||||||
|
|
||||||
map.connect 'wiki/:id/:page/:action', :controller => 'wiki', :page => nil
|
map.connect 'wiki/:id/:page/:action', :controller => 'wiki', :page => nil
|
||||||
map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
|
map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
|
||||||
|
|
Loading…
Reference in New Issue