fix error

This commit is contained in:
邱博亞 2022-01-24 12:56:17 +08:00
parent 7ca92d40bd
commit 44df301aca
1 changed files with 7 additions and 4 deletions

View File

@ -8,13 +8,16 @@ module LdapLogin::Login
login_flag = false
url = '/'
url_method = 'redirect_to'
uri = URI(LDAP_ADSERVER)
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
req.body = {AppKey: AppKey,username: ldap_user,password: ldap_pass}.to_json
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(req)
end
req.read_timeout = 3000
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
res = http.request(req)
if res.code == '200' && JSON.load(res.body)["userID"]==ldap_user
if !user.nil?