Complete for 229 check.
This commit is contained in:
1 parent
678f1eabef
commit
3209f9aa27
10 files changed
+187
-5
No files matched your search
@@ -17,7 +17,8 @@ class SessionsController < Devise::SessionsController
|
||||
if ldap.bind
|
||||
result = ldap.bind_as(:base => ldap_base,:filter => ldap_filter,:password=> login_password)
|
||||
if result
|
||||
resource = User.find_or_initialize_by( nccu_ldap_uid: login_uid )
|
||||
nccu_id = get_nccu_id_from_mid_site(login_uid)
|
||||
resource = User.first(conditions:{ nccu_id: nccu_id })
|
||||
# resource = env['warden'].authenticate!(:check_nccu_ldap)
|
||||
# resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
|
||||
set_flash_message(:notice, :signed_in) if is_navigational_format?
|
||||
@@ -33,5 +34,21 @@ class SessionsController < Devise::SessionsController
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def get_nccu_id_from_mid_site(ldap_id)
|
||||
nccu_id = MID_CLIENT.query("SELECT nccu_id FROM rss_aaldap_view WHERE ldap_id='#{ldap_id}' LIMIT 1").first['nccu_id'] rescue nil
|
||||
#
|
||||
# if nccu_id.nil?
|
||||
# #show_error
|
||||
# p 'account not exist'
|
||||
# #should return?
|
||||
# end
|
||||
# # User.first(conditions: { })
|
||||
# rss_pautlst_ut = MID_CLIENT.query("SELECT * FROM rss_pautlst_ut WHERE nccu_id='#{nccu_id}' LIMIT 1").first rescue nil
|
||||
# # rss_paunit = client.query("SELECT * FROM rss_paunit LIMIT 1").first rescue nil
|
||||
# user = User.find_or_create_by(:nccu_id => nccu_id)
|
||||
# p user
|
||||
# # p rss_paunit
|
||||
#
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user