注册界面姓氏文本框内容修改

This commit is contained in:
linhk 2014-09-16 14:08:44 +08:00
parent 185bbf3cf7
commit aabd183299
1 changed files with 16 additions and 0 deletions

View File

@ -110,6 +110,8 @@ class AccountController < ApplicationController
@cache_city = params[:city]||"" #城市
@cache_enterprise_name = params[:enterprise_name]||"" #企业
firstname_code = ""
lastname_code = ""
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if request.get?
session[:auth_source_registration] = nil
@ -119,6 +121,8 @@ class AccountController < ApplicationController
@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
@ -141,10 +145,18 @@ class AccountController < ApplicationController
end
if(@cache_identityy == "")
if params[:identity] == "2"
@user.firstname = firstname_code
@user.lastname = lastname_code
end
flash.now[:error]= l(:label_identity)+l(:'activerecord.errors.messages.empty')
return
end
if(@cache_city == "")
if params[:identity] == "2"
@user.firstname = firstname_code
@user.lastname = lastname_code
end
flash.now[:error]= l(:label_location)+l(:'activerecord.errors.messages.empty')
return
end
@ -174,6 +186,10 @@ class AccountController < ApplicationController
end
end
if params[:identity] == "2"
@user.firstname = firstname_code
@user.lastname = lastname_code
end
end
# Token based account activation