注册时候加点日志调试用
This commit is contained in:
parent
22f4fbf089
commit
7d81a52308
|
@ -139,7 +139,12 @@ class AccountController < ApplicationController
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
us = UsersService.new
|
us = UsersService.new
|
||||||
|
tStarttime = Time.now
|
||||||
@user = us.register user_params.merge(:should_confirmation_password => true)
|
@user = us.register user_params.merge(:should_confirmation_password => true)
|
||||||
|
tEndtime = Time.now
|
||||||
|
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
|
||||||
|
logger.info "register_1 wait time = #{tUsedtime} ms"
|
||||||
|
|
||||||
case Setting.self_registration
|
case Setting.self_registration
|
||||||
when '1'
|
when '1'
|
||||||
#register_by_email_activation(@user)
|
#register_by_email_activation(@user)
|
||||||
|
@ -149,9 +154,13 @@ class AccountController < ApplicationController
|
||||||
end
|
end
|
||||||
when '3'
|
when '3'
|
||||||
#register_automatically(@user)
|
#register_automatically(@user)
|
||||||
|
tStarttime = Time.now
|
||||||
if !@user.new_record?
|
if !@user.new_record?
|
||||||
self.logged_user = @user
|
self.logged_user = @user
|
||||||
flash[:notice] = l(:notice_account_activated)
|
flash[:notice] = l(:notice_account_activated)
|
||||||
|
tEndtime = Time.now
|
||||||
|
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
|
||||||
|
logger.info "register_2 wait time = #{tUsedtime} ms"
|
||||||
redirect_to my_account_url(:tip=>1)
|
redirect_to my_account_url(:tip=>1)
|
||||||
else
|
else
|
||||||
redirect_to signin_path
|
redirect_to signin_path
|
||||||
|
|
|
@ -33,10 +33,14 @@ module AccountHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def automatically_register(user, &block)
|
def automatically_register(user, &block)
|
||||||
|
tStarttime = Time.now
|
||||||
# Automatic activation
|
# Automatic activation
|
||||||
user.activate
|
user.activate
|
||||||
user.last_login_on = Time.now
|
user.last_login_on = Time.now
|
||||||
if user.save
|
if user.save
|
||||||
|
tEndtime = Time.now
|
||||||
|
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
|
||||||
|
logger.info "register_130 wait time = #{tUsedtime} ms"
|
||||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||||
#self.logged_user = user
|
#self.logged_user = user
|
||||||
#flash[:notice] = l(:notice_account_activated)
|
#flash[:notice] = l(:notice_account_activated)
|
||||||
|
@ -44,6 +48,9 @@ module AccountHelper
|
||||||
else
|
else
|
||||||
yield if block_given?
|
yield if block_given?
|
||||||
end
|
end
|
||||||
|
tEndtime = Time.now
|
||||||
|
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
|
||||||
|
logger.info "register_131 wait time = #{tUsedtime} ms"
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ class UsersService
|
||||||
#成功返回注册后的User实例,失败直接抛异常
|
#成功返回注册后的User实例,失败直接抛异常
|
||||||
|
|
||||||
def register(params)
|
def register(params)
|
||||||
|
Rails.logger.info "register_11"
|
||||||
|
Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000
|
||||||
@user = User.new
|
@user = User.new
|
||||||
@user.admin = false
|
@user.admin = false
|
||||||
@user.register
|
@user.register
|
||||||
|
@ -19,6 +21,8 @@ class UsersService
|
||||||
password = params[:password]
|
password = params[:password]
|
||||||
password_confirmation = params[:password_confirmation]
|
password_confirmation = params[:password_confirmation]
|
||||||
should_confirmation_password = params[:should_confirmation_password]
|
should_confirmation_password = params[:should_confirmation_password]
|
||||||
|
Rails.logger.info "register_12"
|
||||||
|
Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000
|
||||||
if !password.blank? && !password_confirmation.blank? && should_confirmation_password
|
if !password.blank? && !password_confirmation.blank? && should_confirmation_password
|
||||||
@user.password, @user.password_confirmation = password, password_confirmation
|
@user.password, @user.password_confirmation = password, password_confirmation
|
||||||
elsif !password.blank? && !should_confirmation_password
|
elsif !password.blank? && !should_confirmation_password
|
||||||
|
@ -26,6 +30,8 @@ class UsersService
|
||||||
else
|
else
|
||||||
@user.password = ""
|
@user.password = ""
|
||||||
end
|
end
|
||||||
|
Rails.logger.info "register_13"
|
||||||
|
Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000
|
||||||
case Setting.self_registration
|
case Setting.self_registration
|
||||||
when '1'
|
when '1'
|
||||||
@user = email_activation_register(@user)
|
@user = email_activation_register(@user)
|
||||||
|
@ -34,11 +40,15 @@ class UsersService
|
||||||
else
|
else
|
||||||
@user = administrator_manually__register(@user)
|
@user = administrator_manually__register(@user)
|
||||||
end
|
end
|
||||||
|
Rails.logger.info "register_14"
|
||||||
|
Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000
|
||||||
if @user.id != nil
|
if @user.id != nil
|
||||||
ue = @user.user_extensions ||= UserExtensions.new
|
ue = @user.user_extensions ||= UserExtensions.new
|
||||||
ue.user_id = @user.id
|
ue.user_id = @user.id
|
||||||
ue.save
|
ue.save
|
||||||
end
|
end
|
||||||
|
Rails.logger.info "register_15"
|
||||||
|
Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000
|
||||||
@user
|
@user
|
||||||
#img_url = url_to_avatar(@user)
|
#img_url = url_to_avatar(@user)
|
||||||
#gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender
|
#gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender
|
||||||
|
|
Loading…
Reference in New Issue