fix login and announcement frontend field
This commit is contained in:
parent
2ea19aa230
commit
752a525778
|
@ -61,44 +61,10 @@ class SessionsController < Devise::SessionsController
|
|||
sign_in(resource_name, resource)
|
||||
redirect_to after_sign_in_path_for(resource)
|
||||
|
||||
else #認證通過無帳號要新增
|
||||
else #認證通過無帳號不通過
|
||||
|
||||
@new_user = User.new
|
||||
|
||||
@new_user.user_id = @LDAP_USER
|
||||
@new_user.admin = false
|
||||
@new_user.email = "#{@LDAP_USER}@ydu.edu.tw"
|
||||
@new_user.password = "#{@LDAP_USER}@ydu.edu.tw"
|
||||
@new_user.created_at = DateTime.now
|
||||
@new_user.updated_at = DateTime.now
|
||||
|
||||
@new_user.cache_dept = { "zh_tw" => ( @datas[1] ? @datas[1] : nil ), "en" => ( @datas[1] ? @datas[1] : nil ) }
|
||||
|
||||
@new_user.first_name_translations = {}
|
||||
|
||||
@new_user.first_name_translations["zh_tw"] = ( @datas[1] ? @datas[1] : nil )
|
||||
|
||||
@new_user.first_name_translations["en"] = ( @datas[1] ? @datas[1] : nil )
|
||||
|
||||
# @new_user.first_name = ( @datas[1] ? @datas[1] : nil )
|
||||
|
||||
if @datas[0] == 'P'
|
||||
|
||||
@new_user.last_name_translations = {}
|
||||
|
||||
@new_user.last_name_translations["zh_tw"] = ( @datas[2] ? @datas[2] : nil )
|
||||
|
||||
@new_user.last_name_translations["en"] = ( @datas[2] ? @datas[2] : nil )
|
||||
|
||||
# @new_user.last_name = ( @datas[2] ? @datas[2] : nil )
|
||||
|
||||
end
|
||||
|
||||
@new_user.save
|
||||
|
||||
resource_name = @new_user.class.to_s.downcase
|
||||
sign_in(resource_name, @new_user)
|
||||
redirect_to after_sign_in_path_for(@new_user)
|
||||
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||
redirect_to :root
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#built-in-modules
|
||||
gem 'archive', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-archive.git'
|
||||
gem 'announcement', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-announcement.git'
|
||||
gem 'announcement', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-announcement.git', :branch => 'ydu'
|
||||
gem 'gallery', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-gallery.git'
|
||||
gem 'member', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-member.git'
|
||||
gem 'member_staff', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-memberstaff.git'
|
||||
|
|
Loading…
Reference in New Issue