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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64272f39bbb1397e25389d8b596f1d66cb940dd350e4d32cddc3334567dda01a
4
- data.tar.gz: c14332035bf008e1ed5c8a812e27590677bcff97887b0df36a24f820d8956103
3
+ metadata.gz: fb1a10fbd6c774433b37b339e044940d59f8642df927bc80cf51f55b3d113df1
4
+ data.tar.gz: 870313cc1052177ae59d0b5a25694683f4aa98ac401183283ff69b1c9f25146f
5
5
  SHA512:
6
- metadata.gz: a842d49963961e790f055fe069db1805606e56d5b281193cbd5e1267b675163dc07871981c20f5a77064864ab72a450ee5e6a8ce654b7213c192265ef6181832
7
- data.tar.gz: f0510454c1f24fcf8c0576aad604673d78de886ced7b4cbece782c09ee8be93f4fa63b877095909be0c276fb04a76249d93ff7a34609edcb20dc64b20de5b24b
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[:name]
27
- groups = hsh[:groups]
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/active_app/login1.php"
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")
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
@@ -1,3 +1,3 @@
1
1
  module LwqzxAuth
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
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.6
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-03-18 00:00:00.000000000 Z
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
- rubyforge_project:
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.