Description:
fix cucas authen, the old code work on 2.1.2 but not 1.9.2
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r407:b11b67ad58fb - - 1 file changed: 9 inserted, 2 deleted
@@ -109,8 +109,15 | |||
|
109 | 109 | |
|
110 | 110 | #simple call |
|
111 | 111 | begin |
|
112 | - resp = Net::HTTP.post_form(url, post_args) | |
|
113 | - result = JSON.parse resp.body | |
|
112 | + http = Net::HTTP.new('www.cas.chula.ac.th', 443) | |
|
113 | + http.use_ssl = true | |
|
114 | + result = [ ] | |
|
115 | + http.start do |http| | |
|
116 | + req = Net::HTTP::Post.new('/cas/api/?q=studentAuthenticate') | |
|
117 | + param = "appid=#{appid}&appsecret=#{appsecret}&username=#{login}&password=#{password}" | |
|
118 | + resp = http.request(req,param) | |
|
119 | + result = JSON.parse resp.body | |
|
120 | + end | |
|
114 | 121 | return true if result["type"] == "beanStudent" |
|
115 | 122 | rescue |
|
116 | 123 | return false |
You need to be logged in to leave comments.
Login now