修正密码长度判断错误问题
This commit is contained in:
parent
2a7e0365b8
commit
fa1e7c9a04
11
Gemfile.lock
11
Gemfile.lock
|
@ -122,7 +122,6 @@ GEM
|
||||||
htmlentities (4.3.2)
|
htmlentities (4.3.2)
|
||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
ice_nine (0.11.0)
|
ice_nine (0.11.0)
|
||||||
iconv (1.0.4)
|
|
||||||
journey (1.0.4)
|
journey (1.0.4)
|
||||||
jquery-rails (2.0.3)
|
jquery-rails (2.0.3)
|
||||||
railties (>= 3.1.0, < 5.0)
|
railties (>= 3.1.0, < 5.0)
|
||||||
|
@ -172,8 +171,6 @@ GEM
|
||||||
win32console (~> 1.3)
|
win32console (~> 1.3)
|
||||||
pry-nav (0.2.3)
|
pry-nav (0.2.3)
|
||||||
pry (~> 0.9.10)
|
pry (~> 0.9.10)
|
||||||
puma (2.10.1)
|
|
||||||
rack (>= 1.1, < 2.0)
|
|
||||||
rack (1.4.5)
|
rack (1.4.5)
|
||||||
rack-accept (0.4.5)
|
rack-accept (0.4.5)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
|
@ -222,7 +219,6 @@ GEM
|
||||||
sass-rails
|
sass-rails
|
||||||
rmagick (2.13.2)
|
rmagick (2.13.2)
|
||||||
ruby-openid (2.1.8)
|
ruby-openid (2.1.8)
|
||||||
ruby-prof (0.15.2)
|
|
||||||
rubyzip (1.1.6)
|
rubyzip (1.1.6)
|
||||||
sass (3.3.10)
|
sass (3.3.10)
|
||||||
sass-rails (3.2.6)
|
sass-rails (3.2.6)
|
||||||
|
@ -273,8 +269,6 @@ GEM
|
||||||
win32console (1.3.2-x86-mingw32)
|
win32console (1.3.2-x86-mingw32)
|
||||||
xpath (2.0.0)
|
xpath (2.0.0)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
zip-zip (0.3)
|
|
||||||
rubyzip (>= 1.0.0)
|
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
@ -297,7 +291,6 @@ DEPENDENCIES
|
||||||
guard-test (~> 1.0.0)
|
guard-test (~> 1.0.0)
|
||||||
htmlentities
|
htmlentities
|
||||||
i18n (~> 0.6.0)
|
i18n (~> 0.6.0)
|
||||||
iconv
|
|
||||||
jquery-rails (~> 2.0.2)
|
jquery-rails (~> 2.0.2)
|
||||||
kaminari
|
kaminari
|
||||||
mocha (~> 1.1.0)
|
mocha (~> 1.1.0)
|
||||||
|
@ -307,15 +300,12 @@ DEPENDENCIES
|
||||||
paperclip (~> 3.5.4)
|
paperclip (~> 3.5.4)
|
||||||
pry
|
pry
|
||||||
pry-nav
|
pry-nav
|
||||||
puma
|
|
||||||
rack-mini-profiler!
|
rack-mini-profiler!
|
||||||
rack-openid
|
rack-openid
|
||||||
rails (= 3.2.13)
|
rails (= 3.2.13)
|
||||||
rich (= 1.4.6)
|
rich (= 1.4.6)
|
||||||
rmagick (>= 2.0.0)
|
rmagick (>= 2.0.0)
|
||||||
ruby-openid (~> 2.1.4)
|
ruby-openid (~> 2.1.4)
|
||||||
ruby-prof (~> 0.15.1)
|
|
||||||
rubyzip
|
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
seems_rateable!
|
seems_rateable!
|
||||||
selenium-webdriver (~> 2.42.0)
|
selenium-webdriver (~> 2.42.0)
|
||||||
|
@ -323,4 +313,3 @@ DEPENDENCIES
|
||||||
spork-testunit (~> 0.0.8)
|
spork-testunit (~> 0.0.8)
|
||||||
therubyracer
|
therubyracer
|
||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
zip-zip
|
|
||||||
|
|
|
@ -107,16 +107,6 @@ class AccountController < ApplicationController
|
||||||
@user = User.new(:language => current_language.to_s)
|
@user = User.new(:language => current_language.to_s)
|
||||||
else
|
else
|
||||||
user_params = params[:user] || {}
|
user_params = params[:user] || {}
|
||||||
#@user = User.new
|
|
||||||
#@user.safe_attributes = user_params
|
|
||||||
#if params[:identity] == "2" # 2 企业
|
|
||||||
# firstname_code = @user.firstname
|
|
||||||
# lastname_code = @user.lastname
|
|
||||||
# @user.firstname = params[:enterprise_name]
|
|
||||||
# @user.lastname = l(:field_enterprise)
|
|
||||||
#end
|
|
||||||
#@user.admin = false
|
|
||||||
#@user.register
|
|
||||||
if session[:auth_source_registration]
|
if session[:auth_source_registration]
|
||||||
@user.activate
|
@user.activate
|
||||||
@user.login = session[:auth_source_registration][:login]
|
@user.login = session[:auth_source_registration][:login]
|
||||||
|
@ -128,9 +118,9 @@ class AccountController < ApplicationController
|
||||||
redirect_to my_account_path
|
redirect_to my_account_path
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
us = UsersService.new
|
us = UsersService.new
|
||||||
@user = us.register user_params.merge(:should_confirmation_password => true)
|
@user = us.register user_params.merge(:should_confirmation_password => true)
|
||||||
case Setting.self_registration
|
case Setting.self_registration
|
||||||
when '1'
|
when '1'
|
||||||
#register_by_email_activation(@user)
|
#register_by_email_activation(@user)
|
||||||
unless @user.new_record?
|
unless @user.new_record?
|
||||||
|
@ -139,7 +129,7 @@ class AccountController < ApplicationController
|
||||||
when '3'
|
when '3'
|
||||||
#register_automatically(@user)
|
#register_automatically(@user)
|
||||||
unless @user.new_record?
|
unless @user.new_record?
|
||||||
self.logged_user = user
|
self.logged_user = @user
|
||||||
flash[:notice] = l(:notice_account_activated)
|
flash[:notice] = l(:notice_account_activated)
|
||||||
redirect_to my_account_url
|
redirect_to my_account_url
|
||||||
end
|
end
|
||||||
|
@ -148,37 +138,7 @@ class AccountController < ApplicationController
|
||||||
unless @user.new_record?
|
unless @user.new_record?
|
||||||
account_pending
|
account_pending
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# @user.login = params[:user][:login]
|
|
||||||
# unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank?
|
|
||||||
# @user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# case Setting.self_registration
|
|
||||||
# when '1'
|
|
||||||
# register_by_email_activation(@user)
|
|
||||||
# when '3'
|
|
||||||
# register_automatically(@user)
|
|
||||||
# else
|
|
||||||
# register_manually_by_administrator(@user)
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# #added by bai
|
|
||||||
# if @user.id != nil
|
|
||||||
# ue = @user.user_extensions ||= UserExtensions.new
|
|
||||||
# #ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => )
|
|
||||||
# ue.identity = params[:identity].to_i
|
|
||||||
# ue.technical_title = params[:technical_title]
|
|
||||||
# ue.gender = params[:gender].to_i
|
|
||||||
# ue.user_id = @user.id
|
|
||||||
# ue.student_id = params[:no]
|
|
||||||
# ue.location = params[:province] if params[:province] != nil
|
|
||||||
# ue.location_city = params[:city] if params[:city] != nil
|
|
||||||
# ue.save
|
|
||||||
# end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ 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]
|
||||||
if !password.blank? && !password_confirmation && 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
|
||||||
@user.password = password
|
@user.password = password
|
||||||
|
|
Loading…
Reference in New Issue