lwqzx_auth 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/lwqzx_auth/auth_controller.rb +8 -12
- data/lib/lwqzx_auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64272f39bbb1397e25389d8b596f1d66cb940dd350e4d32cddc3334567dda01a
|
4
|
+
data.tar.gz: c14332035bf008e1ed5c8a812e27590677bcff97887b0df36a24f820d8956103
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a842d49963961e790f055fe069db1805606e56d5b281193cbd5e1267b675163dc07871981c20f5a77064864ab72a450ee5e6a8ce654b7213c192265ef6181832
|
7
|
+
data.tar.gz: f0510454c1f24fcf8c0576aad604673d78de886ced7b4cbece782c09ee8be93f4fa63b877095909be0c276fb04a76249d93ff7a34609edcb20dc64b20de5b24b
|
@@ -12,9 +12,9 @@ module LwqzxAuth
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def auth
|
15
|
-
|
15
|
+
unless verify_rucaptcha?
|
16
16
|
flash[:alert] = "验证码出错"
|
17
|
-
|
17
|
+
redirect_to main_app.root_path and return
|
18
18
|
end
|
19
19
|
|
20
20
|
login = params[:login]
|
@@ -35,20 +35,16 @@ module LwqzxAuth
|
|
35
35
|
private
|
36
36
|
def lauth(login,passwd)
|
37
37
|
lurl = "http://www.lwqzx.sdedu.net/kernel/net_school/active_app/login1.php"
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
aurl = "http://www.lwqzx.sdedu.net/kernel/net_school/islogin.php"
|
42
|
-
ares = %x[curl -s -b /tmp/cookies #{aurl}]
|
43
|
-
return {} if ares.to_s == "0"
|
44
|
-
infos = %x[curl -s -b /tmp/cookies #{lurl}]
|
45
|
-
content=infos.encode("UTF-8","GB2312")
|
38
|
+
res1 = RestClient.post lurl,{login_user_m_: login, login_password: passwd}
|
39
|
+
res2 = RestClient.get lurl,{cookies: res1.cookies}
|
40
|
+
content=res2.body.encode("UTF-8","GB2312")
|
46
41
|
doc = Nokogiri::HTML(content)
|
42
|
+
return {} if doc.include?("login_submit")
|
47
43
|
uname = doc.css("span.tt1 a:nth-child(1)").text
|
48
44
|
groups = doc.css("span.tt1 a:nth-child(5)")[0]["title"]
|
49
|
-
%x[rm /tmp/cookies]
|
50
45
|
groups=groups.gsub("[","").gsub("]","").split("@").compact.reject(&:empty?)
|
51
46
|
return {login: login, name: uname, groups: groups}
|
52
|
-
end
|
47
|
+
end
|
48
|
+
|
53
49
|
end
|
54
50
|
end
|
data/lib/lwqzx_auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lwqzx_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zxy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: auth function into host app.
|
14
14
|
email:
|