tachiban 0.5.0 → 0.6.0

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
- SHA1:
3
- metadata.gz: 32f1f2b6604c7cda5393b06aad44f4ea84397a0d
4
- data.tar.gz: 6e6dbbb843fae38ed80dc10034071da0b669d3ef
2
+ SHA256:
3
+ metadata.gz: dbed304e57a26c26e3ea5cbf31fba4695874e4dfd0fe970cb594d2f9813fd40a
4
+ data.tar.gz: 339c055cd0b4332209105978b80d166442afe66bdfe80010060f993a669a182c
5
5
  SHA512:
6
- metadata.gz: ee08ab9357babdfef72ad367eb31f2815a1dbfffed18d2c0e526b0d9b411edee1bfc1124d5cd02052677b08cd966a4e114ac55365fa9fd2d30440e72ed0edc7b
7
- data.tar.gz: 98e960466e21300d6973b405d493ecba1cb691a58e85296775468390a0c9acebe678cd8ce31665071342c025b5ecf731fbcf1b839f75b9a6283f009a427c2230
6
+ metadata.gz: b166459f8e81b4a8c4fb4c36748248375827039417f3c6956effa468e6d63705269f8e4398549f63ca957e4c594234a949ba435689ebcc0dd729022f42b92c37
7
+ data.tar.gz: d5e86dbd7e51d2529605181f498c11e0cee731782ce021e8547d4717fdd642e4fca45eafa72f8a8e4d9a1fe1eef149671fd66beea1a85f3456ac5f15937bc327
data/.gitignore CHANGED
File without changes
File without changes
File without changes
data/Gemfile CHANGED
File without changes
File without changes
data/README.md CHANGED
@@ -44,7 +44,7 @@ end
44
44
 
45
45
  ## Usage
46
46
 
47
- #### Prerequisites
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
- #### Usage
61
+ ### Usage
62
62
 
63
- ###### Signup
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
- ###### Login
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
- ###### Authentication
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
- ###### Session handling
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
- ###### Password reset
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
- ###### Authorization
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Tachiban
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
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.5.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: 2017-08-22 00:00:00.000000000 Z
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.5.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