da-has_token 1.0.1 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +6 -6
- data/lib/da-has_token/version.rb +1 -1
- data/test/dummy/log/test.log +40 -0
- metadata +68 -93
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c685fa877fce595d8e934e6e7f31fd39be5291c8350270d199401ea31f822af5
|
4
|
+
data.tar.gz: 319d6cbc07bdab771b7b6310f92270312611321e036e5370fdc7dc863aa1b895
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 374b6b6df1aba8bb9fb5462dad5228094aafd73649dc0b734bbee68a5f903c89ff7e468bdead6042e1bf6ed925fb352380895a56cb3646a4970e78327ac7e87d
|
7
|
+
data.tar.gz: c3af306c769934374d81f3ec2d25c3939c32e1a4c2c295b3676916fdd72220a5b1e5dc13a8c45ec4837ed23dc0a46534b59095f4b261f28d89c38a54c32cab48
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# da-has_token
|
2
2
|
|
3
|
-
A token generator for Rails 3 and Active Record.
|
3
|
+
A token generator for Ruby on Rails 3 and Active Record.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Put the following gem requirement in your `Gemfile`:
|
8
8
|
|
9
|
-
gem "da-has_token"
|
9
|
+
gem "da-has_token"
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
@@ -18,17 +18,17 @@ class Entry < ActiveRecord::Base
|
|
18
18
|
has_token
|
19
19
|
|
20
20
|
# Use custom token size
|
21
|
-
# has_token :
|
21
|
+
# has_token size: 25
|
22
22
|
|
23
23
|
# Use custom set of characters
|
24
|
-
# has_token :
|
24
|
+
# has_token chars: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
25
25
|
end
|
26
26
|
```
|
27
27
|
|
28
28
|
The token is set in a `before_create` callback. There is a possible race condition when checking if a newly generated token already exists – make sure to add an unique index to the `token` column in the database.
|
29
29
|
|
30
|
-
A `NoMoreTokens` error is raised if a new unique token can not be generated within [`HasToken::TokenGenerator::MAX_TRIES`](https://github.com/die-antwort/da-has_token/blob/master/lib/has_token/token_generator.rb#L4).
|
30
|
+
A `NoMoreTokens` error is raised if a new unique token can not be generated within [`HasToken::TokenGenerator::MAX_TRIES`](https://github.com/die-antwort/da-has_token/blob/master/lib/da-has_token/token_generator.rb#L4).
|
31
31
|
|
32
32
|
There are similar plugins providing more features configuration options, e.g. https://github.com/mindbox/has_token.
|
33
33
|
|
34
|
-
This project is released under the MIT license.
|
34
|
+
This project is released under the MIT license.
|
data/lib/da-has_token/version.rb
CHANGED
data/test/dummy/log/test.log
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
2
|
+
-------------------------------------------
|
3
|
+
HasTokenTest: test_no_more_tokens_exception
|
4
|
+
-------------------------------------------
|
5
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
6
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
7
|
+
----------------------------
|
8
|
+
HasTokenTest: test_new_token
|
9
|
+
----------------------------
|
10
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
11
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
12
|
+
---------------------------------
|
13
|
+
HasTokenTest: test_new_token_size
|
14
|
+
---------------------------------
|
15
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
16
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
17
|
+
----------------------------------
|
18
|
+
HasTokenTest: test_new_token_chars
|
19
|
+
----------------------------------
|
20
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
21
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
22
|
+
---------------------------------
|
23
|
+
HasTokenTest: test_new_token_size
|
24
|
+
---------------------------------
|
25
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
26
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
27
|
+
----------------------------
|
28
|
+
HasTokenTest: test_new_token
|
29
|
+
----------------------------
|
30
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
31
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
32
|
+
----------------------------------
|
33
|
+
HasTokenTest: test_new_token_chars
|
34
|
+
----------------------------------
|
35
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
36
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
37
|
+
-------------------------------------------
|
38
|
+
HasTokenTest: test_no_more_tokens_exception
|
39
|
+
-------------------------------------------
|
40
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
metadata
CHANGED
@@ -1,76 +1,68 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: da-has_token
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 1.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.4
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Stefan Daschek
|
14
8
|
- Moritz Kobrna
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
|
-
requirements:
|
25
|
-
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 7
|
28
|
-
segments:
|
29
|
-
- 3
|
30
|
-
- 0
|
31
|
-
version: "3.0"
|
12
|
+
date: 2023-06-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
32
15
|
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.0'
|
33
21
|
type: :runtime
|
34
22
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
|
-
requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
40
25
|
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
- 0
|
45
|
-
version: "0"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
46
29
|
name: sqlite3
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
47
35
|
type: :development
|
48
36
|
prerelease: false
|
49
|
-
|
50
|
-
|
51
|
-
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
description: Use `has_token` in your model to automatically generate a unique token
|
43
|
+
on before_create. (Model needs to have a `token` field with type string.)
|
44
|
+
email:
|
52
45
|
- stefan@die-antwort.eu
|
53
46
|
- mo@die-antwort.eu
|
54
47
|
executables: []
|
55
|
-
|
56
48
|
extensions: []
|
57
|
-
|
58
49
|
extra_rdoc_files: []
|
59
|
-
|
60
|
-
|
50
|
+
files:
|
51
|
+
- MIT-LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/da-has_token.rb
|
61
55
|
- lib/da-has_token/active_record.rb
|
62
56
|
- lib/da-has_token/railtie.rb
|
63
57
|
- lib/da-has_token/token_generator.rb
|
64
58
|
- lib/da-has_token/version.rb
|
65
|
-
-
|
66
|
-
- MIT-LICENSE
|
67
|
-
- Rakefile
|
68
|
-
- README.md
|
59
|
+
- test/dummy/Rakefile
|
69
60
|
- test/dummy/app/assets/javascripts/application.js
|
70
61
|
- test/dummy/app/assets/stylesheets/application.css
|
71
62
|
- test/dummy/app/controllers/application_controller.rb
|
72
63
|
- test/dummy/app/helpers/application_helper.rb
|
73
64
|
- test/dummy/app/views/layouts/application.html.erb
|
65
|
+
- test/dummy/config.ru
|
74
66
|
- test/dummy/config/application.rb
|
75
67
|
- test/dummy/config/boot.rb
|
76
68
|
- test/dummy/config/database.yml
|
@@ -86,83 +78,66 @@ files:
|
|
86
78
|
- test/dummy/config/initializers/wrap_parameters.rb
|
87
79
|
- test/dummy/config/locales/en.yml
|
88
80
|
- test/dummy/config/routes.rb
|
89
|
-
- test/dummy/config.ru
|
90
|
-
- test/dummy/db/development.sqlite3
|
91
81
|
- test/dummy/db/test.sqlite3
|
92
|
-
- test/dummy/log/development.log
|
93
82
|
- test/dummy/log/test.log
|
94
83
|
- test/dummy/public/404.html
|
95
84
|
- test/dummy/public/422.html
|
96
85
|
- test/dummy/public/500.html
|
97
86
|
- test/dummy/public/favicon.ico
|
98
|
-
- test/dummy/Rakefile
|
99
87
|
- test/dummy/script/rails
|
100
88
|
- test/has_token_test.rb
|
101
89
|
- test/test_helper.rb
|
102
90
|
homepage: https://github.com/die-antwort/da-has_token
|
103
91
|
licenses: []
|
104
|
-
|
92
|
+
metadata: {}
|
105
93
|
post_install_message:
|
106
94
|
rdoc_options: []
|
107
|
-
|
108
|
-
require_paths:
|
95
|
+
require_paths:
|
109
96
|
- lib
|
110
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
-
|
112
|
-
requirements:
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
113
99
|
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
version: "0"
|
119
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
|
-
requirements:
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
122
104
|
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
|
125
|
-
segments:
|
126
|
-
- 0
|
127
|
-
version: "0"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
128
107
|
requirements: []
|
129
|
-
|
130
|
-
rubyforge_project:
|
131
|
-
rubygems_version: 1.8.21
|
108
|
+
rubygems_version: 3.1.6
|
132
109
|
signing_key:
|
133
|
-
specification_version:
|
134
|
-
summary: Simple has_token plugin for Rails
|
135
|
-
test_files:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Simple has_token plugin for Rails (Active Record).
|
112
|
+
test_files:
|
113
|
+
- test/dummy/app/controllers/application_controller.rb
|
114
|
+
- test/dummy/app/views/layouts/application.html.erb
|
136
115
|
- test/dummy/app/assets/javascripts/application.js
|
137
116
|
- test/dummy/app/assets/stylesheets/application.css
|
138
|
-
- test/dummy/app/controllers/application_controller.rb
|
139
117
|
- test/dummy/app/helpers/application_helper.rb
|
140
|
-
- test/dummy/
|
141
|
-
- test/dummy/config/
|
142
|
-
- test/dummy/config/boot.rb
|
143
|
-
- test/dummy/config/database.yml
|
144
|
-
- test/dummy/config/environment.rb
|
145
|
-
- test/dummy/config/environments/development.rb
|
118
|
+
- test/dummy/config/routes.rb
|
119
|
+
- test/dummy/config/locales/en.yml
|
146
120
|
- test/dummy/config/environments/production.rb
|
121
|
+
- test/dummy/config/environments/development.rb
|
147
122
|
- test/dummy/config/environments/test.rb
|
123
|
+
- test/dummy/config/environment.rb
|
124
|
+
- test/dummy/config/application.rb
|
125
|
+
- test/dummy/config/database.yml
|
126
|
+
- test/dummy/config/boot.rb
|
148
127
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
149
|
-
- test/dummy/config/initializers/inflections.rb
|
150
128
|
- test/dummy/config/initializers/mime_types.rb
|
151
|
-
- test/dummy/config/initializers/secret_token.rb
|
152
129
|
- test/dummy/config/initializers/session_store.rb
|
153
130
|
- test/dummy/config/initializers/wrap_parameters.rb
|
154
|
-
- test/dummy/config/
|
155
|
-
- test/dummy/config/
|
131
|
+
- test/dummy/config/initializers/secret_token.rb
|
132
|
+
- test/dummy/config/initializers/inflections.rb
|
156
133
|
- test/dummy/config.ru
|
157
|
-
- test/dummy/
|
158
|
-
- test/dummy/
|
159
|
-
- test/dummy/
|
160
|
-
- test/dummy/log/test.log
|
161
|
-
- test/dummy/public/404.html
|
134
|
+
- test/dummy/script/rails
|
135
|
+
- test/dummy/Rakefile
|
136
|
+
- test/dummy/public/favicon.ico
|
162
137
|
- test/dummy/public/422.html
|
163
138
|
- test/dummy/public/500.html
|
164
|
-
- test/dummy/public/
|
165
|
-
- test/dummy/
|
166
|
-
- test/dummy/
|
139
|
+
- test/dummy/public/404.html
|
140
|
+
- test/dummy/db/test.sqlite3
|
141
|
+
- test/dummy/log/test.log
|
167
142
|
- test/has_token_test.rb
|
168
143
|
- test/test_helper.rb
|
File without changes
|
File without changes
|