This commit is contained in:
sw 2015-08-29 15:42:11 +08:00
commit 63c7ea8d4e
5 changed files with 13 additions and 12 deletions

View File

@ -27,7 +27,7 @@ class AccountController < ApplicationController
if request.get?
@login = params[:login] || true
if User.current.logged?
redirect_to home_url
redirect_to user_path(User.current)
else
render :layout => 'login'
end
@ -58,7 +58,7 @@ class AccountController < ApplicationController
# Lets user choose a new password
def lost_password
(redirect_to(home_url); return) unless Setting.lost_password?
(redirect_to(signin_path); return) unless Setting.lost_password?
if params[:token]
@token = Token.find_token("recovery", params[:token].to_s)
if @token.nil? || @token.expired?
@ -110,7 +110,7 @@ class AccountController < ApplicationController
# User self-registration
def register
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
(redirect_to(signin_path); return) unless Setting.self_registration? || session[:auth_source_registration]
if request.get?
session[:auth_source_registration] = nil
@user = User.new(:language => current_language.to_s)
@ -187,11 +187,11 @@ class AccountController < ApplicationController
# Token based account activation
def activate
(redirect_to(home_url); return) unless Setting.self_registration? && params[:token].present?
(redirect_to(signin_path); return) unless Setting.self_registration? && params[:token].present?
token = Token.find_token('register', params[:token].to_s)
(redirect_to(home_url); return) unless token and !token.expired?
(redirect_to(signin_path); return) unless token and !token.expired?
user = token.user
(redirect_to(home_url); return) unless user.registered?
(redirect_to(signin_path); return) unless user.registered?
user.activate
if user.save
token.destroy
@ -278,7 +278,7 @@ class AccountController < ApplicationController
user = User.find_or_initialize_by_identity_url(identity_url)
if user.new_record?
# Self-registration off
(redirect_to(home_url); return) unless Setting.self_registration?
(redirect_to(signin_path); return) unless Setting.self_registration?
# Create on the fly
user.login = registration['nickname'] unless registration['nickname'].nil?

View File

@ -557,7 +557,7 @@ class ApplicationController < ActionController::Base
end
def redirect_back_or_default(default, options={})
back_url = params[:back_url].to_s
back_url = '' #params[:back_url].to_s
if back_url.present?
begin
uri = URI.parse(back_url)

View File

@ -174,7 +174,7 @@ class MyController < ApplicationController
logout_user
flash.now[:notice] = l(:notice_account_deleted)
end
redirect_to home_url
redirect_to signin_path
end
end

View File

@ -207,7 +207,7 @@ class SoftapplicationsController < ApplicationController
@softapplication.destroy
respond_to do |format|
format.html { redirect_to home_url }
format.html { redirect_to signin_path }
format.json { head :no_content }
end
end

View File

@ -27,7 +27,8 @@ class WelcomeController < ApplicationController
def index
# 企业版定制: params[:project]为传过来的参数
redirect_to signin_path
return
unless params[:organization].nil?
@organization = Organization.find params[:organization]
# @organization_projects = Project.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all
@ -171,7 +172,7 @@ class WelcomeController < ApplicationController
redirect_to users_search_url(:name => search_condition, :search_by => search_by, :role => :student)
else
#redirect_to home_path, :alert => l(:label_sumbit_empty)
(redirect_to home_url, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
(redirect_to signin_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
end
}
end