tachiban 0.5.0 → 0.6.0
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 +5 -5
- data/.gitignore +0 -0
- data/.travis.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +21 -8
- data/Rakefile +0 -0
- data/lib/tachiban.rb +3 -2
- data/lib/tachiban/commands/commands.rb +0 -0
- data/lib/tachiban/policy_generator/policy_generator.rb +0 -0
- data/lib/tachiban/version.rb +1 -1
- data/tachiban.gemspec +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dbed304e57a26c26e3ea5cbf31fba4695874e4dfd0fe970cb594d2f9813fd40a
|
4
|
+
data.tar.gz: 339c055cd0b4332209105978b80d166442afe66bdfe80010060f993a669a182c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b166459f8e81b4a8c4fb4c36748248375827039417f3c6956effa468e6d63705269f8e4398549f63ca957e4c594234a949ba435689ebcc0dd729022f42b92c37
|
7
|
+
data.tar.gz: d5e86dbd7e51d2529605181f498c11e0cee731782ce021e8547d4717fdd642e4fca45eafa72f8a8e4d9a1fe1eef149671fd66beea1a85f3456ac5f15937bc327
|
data/.gitignore
CHANGED
File without changes
|
data/.travis.yml
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ end
|
|
44
44
|
|
45
45
|
## Usage
|
46
46
|
|
47
|
-
|
47
|
+
### Prerequisites
|
48
48
|
Prior to logging in or authenticating the user, retrieve the entity from the
|
49
49
|
database and assign it to the instance variable of `@user`.
|
50
50
|
|
@@ -58,9 +58,9 @@ The **password_reset_sent_at** can be used to check the reset link validity.
|
|
58
58
|
The only prerequisite for the authorization is the attribute of **role** for the user entity.
|
59
59
|
|
60
60
|
|
61
|
-
|
61
|
+
### Usage
|
62
62
|
|
63
|
-
|
63
|
+
#### Signup
|
64
64
|
The entity for which authentication is used must have the
|
65
65
|
attribute `hashed_pass` to hold the generated hashed password.
|
66
66
|
|
@@ -81,7 +81,7 @@ def call(params)
|
|
81
81
|
end
|
82
82
|
```
|
83
83
|
|
84
|
-
|
84
|
+
#### Login
|
85
85
|
To authenticate a user use the `authenticated?(input_password)` method and log
|
86
86
|
them in with the `login` method. Authentication is successful if the user exists and passwords match.
|
87
87
|
|
@@ -105,12 +105,12 @@ login("You have been successfully logged in.") if authenticated?(password)
|
|
105
105
|
```
|
106
106
|
|
107
107
|
|
108
|
-
|
108
|
+
#### Authentication
|
109
109
|
To check whether the user is logged in use the `check_for_logged_in_user` method.
|
110
110
|
If the user is not logged in the `logout` method takes over.
|
111
111
|
|
112
112
|
|
113
|
-
|
113
|
+
#### Session handling
|
114
114
|
Tachiban handles session expiration by checking if a session has
|
115
115
|
expired and then restarts the session start time if the session
|
116
116
|
is still valid or proceeds with the following if the session
|
@@ -157,7 +157,7 @@ end
|
|
157
157
|
```
|
158
158
|
|
159
159
|
|
160
|
-
|
160
|
+
#### Password reset
|
161
161
|
The password reset feature provides a few simple methods to generate a
|
162
162
|
token, email subject and body. It is also possible to specify and
|
163
163
|
check the validity of the password reset url.
|
@@ -189,7 +189,7 @@ password_reset_url_valid?(link_validity)
|
|
189
189
|
```
|
190
190
|
|
191
191
|
|
192
|
-
|
192
|
+
#### Authorization
|
193
193
|
Authorization support was setup as inspired by [this blog post](http://billpatrianakos.me/blog/2013/10/22/authorize-users-based-on-roles-and-permissions-without-a-gem/).
|
194
194
|
|
195
195
|
Authorization features support the generation of policy files for each controller where authorized roles are specified for each action.
|
@@ -219,6 +219,19 @@ authorized?(controller, role, action)
|
|
219
219
|
- Add generators for entities with required attributes.
|
220
220
|
|
221
221
|
|
222
|
+
### Changelog
|
223
|
+
|
224
|
+
#### 0.6.0
|
225
|
+
|
226
|
+
Method: `Tachiban::login`
|
227
|
+
<br>Change:
|
228
|
+
`session[:current_user]` is not set as the user object, but as the user object id.
|
229
|
+
***
|
230
|
+
Method: `Tachiban::logout`
|
231
|
+
<br>Change:
|
232
|
+
Added `session.clear` to remove any other values upon logout.
|
233
|
+
|
234
|
+
|
222
235
|
## Development
|
223
236
|
|
224
237
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
File without changes
|
data/lib/tachiban.rb
CHANGED
@@ -34,7 +34,7 @@ private
|
|
34
34
|
|
35
35
|
# The login method can be used in combination with the authenticated? method to
|
36
36
|
# log the user in if the authenticated? method returns true. The user is
|
37
|
-
# logged in by setting the user object as the session[:current_user].
|
37
|
+
# logged in by setting the user object id as the session[:current_user].
|
38
38
|
# After the user is logged in the session start time is defined, which is then used
|
39
39
|
# by the session_expired? method to determine whether the session has
|
40
40
|
# expired or not.
|
@@ -43,7 +43,7 @@ private
|
|
43
43
|
# login if authenticated?(input_pass)
|
44
44
|
|
45
45
|
def login(flash_message)
|
46
|
-
session[:current_user] = @user
|
46
|
+
session[:current_user] = @user.id
|
47
47
|
session[:session_start_time] = Time.now
|
48
48
|
flash[:success_notice] = flash_message
|
49
49
|
end
|
@@ -55,6 +55,7 @@ private
|
|
55
55
|
|
56
56
|
def logout
|
57
57
|
session[:current_user] = nil
|
58
|
+
session.clear
|
58
59
|
@redirect_url ||= routes.root_path
|
59
60
|
redirect_to @redirect_url
|
60
61
|
end
|
File without changes
|
File without changes
|
data/lib/tachiban/version.rb
CHANGED
data/tachiban.gemspec
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tachiban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastjan Hribar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
211
|
rubyforge_project:
|
212
|
-
rubygems_version: 2.
|
212
|
+
rubygems_version: 2.7.7
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: Tachiban provides simple password hashing for user authentication with bcrypt
|