lwqzx_auth 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/lwqzx_auth/auth_controller.rb +8 -13
- data/lib/lwqzx_auth/version.rb +1 -1
- metadata +18 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb1a10fbd6c774433b37b339e044940d59f8642df927bc80cf51f55b3d113df1
|
4
|
+
data.tar.gz: 870313cc1052177ae59d0b5a25694683f4aa98ac401183283ff69b1c9f25146f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92d33d2c7ec0d2b5dd5857d2c3bcdfaa563e0908cb5c2fea5f61f70e9ee4bca4d1400d259c7c0dfddf98100ad933a326980630fc3076d0d973403b47385f17a4
|
7
|
+
data.tar.gz: 85ec89c5bf4630e18aff12256700913c6bf1964cf77cfab4b73259d654cc078a6802fa386bbaa10ee8a998eef697e04cd0b913e131fc282531349dd02a99d2f9
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_dependency "lwqzx_auth/application_controller"
|
2
|
+
require "rest-client"
|
2
3
|
|
3
4
|
module LwqzxAuth
|
4
5
|
class AuthController < ApplicationController
|
@@ -20,11 +21,11 @@ module LwqzxAuth
|
|
20
21
|
login = params[:login]
|
21
22
|
psd = params[:password]
|
22
23
|
hsh = lauth(login,psd)
|
23
|
-
if hsh.blank?
|
24
|
+
if hsh["login"].blank?
|
24
25
|
redirect_to login_path , alert: "用户信息有误"
|
25
26
|
else
|
26
|
-
name = hsh[
|
27
|
-
groups = hsh[
|
27
|
+
name = hsh["name"]
|
28
|
+
groups = hsh["user_group"]
|
28
29
|
session[:login] = login
|
29
30
|
session[:realname] = name
|
30
31
|
session[:groups] = groups
|
@@ -34,16 +35,10 @@ module LwqzxAuth
|
|
34
35
|
|
35
36
|
private
|
36
37
|
def lauth(login,passwd)
|
37
|
-
lurl = "http://www.lwqzx.sdedu.net/kernel/net_school/
|
38
|
-
|
39
|
-
|
40
|
-
content
|
41
|
-
doc = Nokogiri::HTML(content)
|
42
|
-
return {} if doc.include?("login_submit")
|
43
|
-
uname = doc.css("span.tt1 a:nth-child(1)").text
|
44
|
-
groups = doc.css("span.tt1 a:nth-child(5)")[0]["title"]
|
45
|
-
groups=groups.gsub("[","").gsub("]","").split("@").compact.reject(&:empty?)
|
46
|
-
return {login: login, name: uname, groups: groups}
|
38
|
+
lurl = "http://www.lwqzx.sdedu.net/kernel/net_school/core/jslogin.php"
|
39
|
+
res = ::RestClient.post lurl,{login: login, password: passwd}
|
40
|
+
content=res.body
|
41
|
+
return content
|
47
42
|
end
|
48
43
|
|
49
44
|
end
|
data/lib/lwqzx_auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zxy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
12
|
-
dependencies:
|
11
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.1'
|
13
27
|
description: auth function into host app.
|
14
28
|
email:
|
15
29
|
- zxy@qq.com
|
@@ -55,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
69
|
- !ruby/object:Gem::Version
|
56
70
|
version: '0'
|
57
71
|
requirements: []
|
58
|
-
|
59
|
-
rubygems_version: 2.7.7
|
72
|
+
rubygems_version: 3.0.3
|
60
73
|
signing_key:
|
61
74
|
specification_version: 4
|
62
75
|
summary: add auth function to host application.
|