lwqzx_auth 0.0.9 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -2
- data/app/helpers/lwqzx_auth/application_helper.rb +41 -5
- data/app/views/lwqzx_auth/auth/login.html.slim +4 -3
- data/lib/lwqzx_auth/engine.rb +1 -0
- data/lib/lwqzx_auth/version.rb +1 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03257e86f6cb105bb53fae5e7057715a68f6faed674c1692152152ef639bd7ac
|
4
|
+
data.tar.gz: 8aaa15c6dce50df06612bcee7c11cbcd67d568f80abc41c772d93ddac35d6f6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 341a0dc82697c61963097b216261c0c585073bbb77cae98c0e1a4f3def826a66a7aa4d00806b7e90eee21c8b30946b6255e298409bdbe179356d7bc940d3964b
|
7
|
+
data.tar.gz: e993a4bfa02902a0fdd9aee1425556fea7ac07b22dbf2f222caffccd74538a7719ee4c78465afd348fe47ac7d314528de567cfb17319215ee2d483116dadd39b
|
data/README.md
CHANGED
@@ -21,8 +21,18 @@ Or install it yourself as:
|
|
21
21
|
$ gem install lwqzx_auth
|
22
22
|
```
|
23
23
|
|
24
|
-
##
|
25
|
-
|
24
|
+
## method added
|
25
|
+
|
26
|
+
attachit : can be used in controller to add tempfile to mongodb
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
group[:logo] = attachit("group",:logo)
|
30
|
+
```
|
31
|
+
pageit: can be used in controller for page model
|
32
|
+
|
33
|
+
is_login? : can be used in controller or views to test login status
|
34
|
+
|
35
|
+
need_login: can be used in controller
|
26
36
|
|
27
37
|
## License
|
28
38
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -1,7 +1,43 @@
|
|
1
1
|
module LwqzxAuth
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
module ApplicationHelper
|
3
|
+
def is_login?
|
4
|
+
!!session[:login]
|
5
|
+
end
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
module ApplicationOnly
|
10
|
+
|
11
|
+
def need_login
|
12
|
+
unless is_login?
|
13
|
+
flash[:alert] = "你还没有登录"
|
14
|
+
redirect_to lwqzx_auth.login_path and return
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def pageit
|
19
|
+
params[:page] ||= 1
|
20
|
+
per_page = 10
|
21
|
+
@num=per_page*(params[:page].to_i-1)
|
22
|
+
end
|
23
|
+
|
24
|
+
def attachit(model,attach = :attach)
|
25
|
+
unless params[model.to_sym][attach].blank?
|
26
|
+
if params[:action] == 'update'
|
27
|
+
old_attach = eval("@#{model}.#{attach.to_s}")
|
28
|
+
unless old_attach.blank?
|
29
|
+
id = BSON::ObjectId.from_string(old_attach['grid_id'])
|
30
|
+
MongoGrid.grid.delete(id)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
attach=params[model.to_sym][attach]
|
34
|
+
MongoGrid.uploadtogrid(attach,width: 300)
|
35
|
+
else
|
36
|
+
if params[:action] == 'update'
|
37
|
+
old_attach = eval("@#{model}.#{attach.to_s}")
|
38
|
+
return old_attach.blank? ? {} : old_attach
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
7
43
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
h2.text-center =<> icon("fas","user") + ' 登 录'
|
2
2
|
br
|
3
3
|
.row
|
4
|
-
.col-
|
5
|
-
.col-
|
4
|
+
.col-sm-4
|
5
|
+
.col-sm-4
|
6
6
|
= form_tag auth_path, role: "form", class: "card form-horizontal" do
|
7
7
|
.card-body
|
8
8
|
strong 登录名
|
@@ -12,7 +12,8 @@ br
|
|
12
12
|
strong 密码:
|
13
13
|
br
|
14
14
|
= password_field_tag :password,nil, class: "form-control"
|
15
|
-
|
16
15
|
|
17
16
|
.card-footer
|
18
17
|
= submit_tag '登录', class: "btn-block btn-primary btn"
|
18
|
+
|
19
|
+
.col-sm-4
|
data/lib/lwqzx_auth/engine.rb
CHANGED
data/lib/lwqzx_auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lwqzx_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zxy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 5.1.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 5.1.0
|
11
|
+
date: 2018-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
27
13
|
description: auth function into host app.
|
28
14
|
email:
|
29
15
|
- zxy@qq.com
|
@@ -69,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
55
|
version: '0'
|
70
56
|
requirements: []
|
71
57
|
rubyforge_project:
|
72
|
-
rubygems_version: 2.7.
|
58
|
+
rubygems_version: 2.7.7
|
73
59
|
signing_key:
|
74
60
|
specification_version: 4
|
75
61
|
summary: add auth function to host application.
|