minimalist_authentication 0.6.14 → 1.0.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +56 -52
  4. data/Rakefile +27 -26
  5. data/{test/rails_root/lib/tasks/.gitkeep → app/assets/config/minimalist_authentication_manifest.js} +0 -0
  6. data/app/views/sessions/_form.html.erb +5 -0
  7. data/app/views/sessions/new.html.erb +1 -0
  8. data/config/routes.rb +2 -0
  9. data/lib/minimalist/authentication.rb +69 -79
  10. data/lib/minimalist/authorization.rb +30 -35
  11. data/lib/minimalist/sessions.rb +45 -49
  12. data/lib/minimalist/test_helper.rb +5 -5
  13. data/lib/minimalist_authentication.rb +3 -1
  14. data/lib/minimalist_authentication/engine.rb +4 -0
  15. data/lib/{minimalist → minimalist_authentication}/version.rb +1 -1
  16. metadata +24 -128
  17. data/.gitignore +0 -6
  18. data/Gemfile +0 -2
  19. data/Gemfile.lock +0 -101
  20. data/lib/app/views/sessions/_form.html.erb +0 -12
  21. data/lib/app/views/sessions/new.html.erb +0 -1
  22. data/minimalist_authentication.gemspec +0 -23
  23. data/test/.gitignore +0 -1
  24. data/test/authentication_test.rb +0 -103
  25. data/test/authorization_test.rb +0 -77
  26. data/test/factories.rb +0 -12
  27. data/test/jenkins.bash +0 -9
  28. data/test/rails_root/README +0 -256
  29. data/test/rails_root/Rakefile +0 -7
  30. data/test/rails_root/app/controllers/application_controller.rb +0 -5
  31. data/test/rails_root/app/controllers/sessions_controller.rb +0 -3
  32. data/test/rails_root/app/helpers/application_helper.rb +0 -2
  33. data/test/rails_root/app/models/user.rb +0 -4
  34. data/test/rails_root/app/views/layouts/application.html.erb +0 -14
  35. data/test/rails_root/config.ru +0 -4
  36. data/test/rails_root/config/application.rb +0 -42
  37. data/test/rails_root/config/boot.rb +0 -13
  38. data/test/rails_root/config/database.yml +0 -22
  39. data/test/rails_root/config/environment.rb +0 -5
  40. data/test/rails_root/config/environments/development.rb +0 -26
  41. data/test/rails_root/config/environments/production.rb +0 -49
  42. data/test/rails_root/config/environments/test.rb +0 -35
  43. data/test/rails_root/config/initializers/backtrace_silencers.rb +0 -7
  44. data/test/rails_root/config/initializers/inflections.rb +0 -10
  45. data/test/rails_root/config/initializers/mime_types.rb +0 -5
  46. data/test/rails_root/config/initializers/secret_token.rb +0 -7
  47. data/test/rails_root/config/initializers/session_store.rb +0 -8
  48. data/test/rails_root/config/locales/en.yml +0 -5
  49. data/test/rails_root/config/routes.rb +0 -5
  50. data/test/rails_root/db/.gitignore +0 -2
  51. data/test/rails_root/db/schema.rb +0 -21
  52. data/test/rails_root/db/seeds.rb +0 -7
  53. data/test/rails_root/doc/README_FOR_APP +0 -2
  54. data/test/rails_root/log/.gitignore +0 -1
  55. data/test/rails_root/log/.gitkeep +0 -0
  56. data/test/rails_root/script/rails +0 -6
  57. data/test/rails_root/test/performance/browsing_test.rb +0 -9
  58. data/test/rails_root/test/test_helper.rb +0 -13
  59. data/test/sessions_test.rb +0 -30
  60. data/test/test_helper.rb +0 -12
@@ -1,59 +1,55 @@
1
1
  module Minimalist
2
2
  module Sessions
3
- def self.included( base )
4
- base.class_eval do
5
- include InstanceMethods
6
- append_view_path File.join(File.dirname(__FILE__), '..', '/app/views')
7
- end
3
+
4
+ def show
5
+ redirect_to new_session_path
8
6
  end
9
7
 
10
- module InstanceMethods
11
- def show
12
- redirect_to new_session_path
13
- end
14
-
15
- def new
16
- end
8
+ def new
9
+ @user = User.new
10
+ end
17
11
 
18
- def create
19
- if user = User.authenticate(params[:email], params[:password])
20
- user.logged_in
21
- session[:user_id] = user.id
22
- after_authentication(user)
23
- redirect_back_or_default(login_redirect_to(user))
24
- return
25
- else
26
- after_authentication_failure(user)
27
- flash.now[:alert] = "Couldn't log you in as '#{params[:email]}'"
28
- render :action => 'new'
29
- end
12
+ def create
13
+ if user = User.authenticate(user_params[:email], user_params[:password])
14
+ user.logged_in
15
+ session[:user_id] = user.id
16
+ after_authentication(user)
17
+ redirect_back_or_default(login_redirect_to(user))
18
+ return
19
+ else
20
+ after_authentication_failure
21
+ flash.now[:alert] = "Couldn't log you in as '#{user_params[:email]}'"
22
+ render action: 'new'
30
23
  end
24
+ end
31
25
 
32
- def destroy
33
- session[:user_id] = nil
34
- flash[:notice] = "You have been logged out."
35
- redirect_to logout_redirect_to
36
- end
37
-
38
- #######
39
- private
40
- #######
41
-
42
- def login_redirect_to(user)
43
- '/'
44
- end
45
-
46
- def logout_redirect_to
47
- '/'
48
- end
49
-
50
- def after_authentication(user)
51
- # overide in application
52
- end
53
-
54
- def after_authentication_failure(user)
55
- # overide in application
56
- end
26
+ def destroy
27
+ session[:user_id] = nil
28
+ flash[:notice] = "You have been logged out."
29
+ redirect_to logout_redirect_to
30
+ end
31
+
32
+
33
+ private
34
+
35
+ def user_params
36
+ @user_params ||= params.require(:user).permit(:email, :password)
37
+ end
38
+
39
+ def login_redirect_to(user)
40
+ '/'
41
+ end
42
+
43
+ def logout_redirect_to
44
+ '/'
45
+ end
46
+
47
+ def after_authentication(user)
48
+ # overide in application
49
+ end
50
+
51
+ def after_authentication_failure
52
+ # overide in application
57
53
  end
58
54
  end
59
55
  end
@@ -1,12 +1,12 @@
1
1
  module Minimalist
2
2
  module TestHelper
3
- # Sets the current user in the session from the user fixtures.
4
- def login_as(user)
5
- @request.session[:user_id] = user ? users(user).id : nil
3
+ def login_as(user_fixture_name, password = 'password')
4
+ post session_path, params: { user: { email: users(user_fixture_name).email, password: password } }
6
5
  end
7
6
 
7
+
8
8
  def current_user
9
- @current_user ||= User.find(@request.session[:user_id])
9
+ @current_user ||= (@request.session[:user_id] ? User.find(@request.session[:user_id]) : nil)
10
10
  end
11
11
  end
12
- end
12
+ end
@@ -1,5 +1,7 @@
1
+ require "minimalist_authentication/engine"
2
+
1
3
  # MinimalistAuthentication
2
4
  require 'minimalist/authentication'
3
5
  require 'minimalist/authorization'
4
6
  require 'minimalist/sessions'
5
- require 'minimalist/test_helper'
7
+ require 'minimalist/test_helper'
@@ -0,0 +1,4 @@
1
+ module MinimalistAuthentication
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module MinimalistAuthentication
2
- VERSION = '0.6.14'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,153 +1,87 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimalist_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.14
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Baldwin
8
- - WWIDEA, Inc
8
+ - Brightways Learning
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-09 00:00:00.000000000 Z
12
+ date: 2017-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: bcrypt
15
+ name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '3.1'
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 3.1.3
20
+ version: '5.0'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
24
  requirements:
28
25
  - - "~>"
29
26
  - !ruby/object:Gem::Version
30
- version: '3.1'
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 3.1.3
27
+ version: '5.0'
34
28
  - !ruby/object:Gem::Dependency
35
- name: rails
36
- requirement: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 3.2.14
41
- type: :development
42
- prerelease: false
43
- version_requirements: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 3.2.14
48
- - !ruby/object:Gem::Dependency
49
- name: sqlite3
29
+ name: bcrypt
50
30
  requirement: !ruby/object:Gem::Requirement
51
31
  requirements:
52
32
  - - "~>"
53
33
  - !ruby/object:Gem::Version
54
- version: '1.3'
34
+ version: '3.1'
55
35
  - - ">="
56
36
  - !ruby/object:Gem::Version
57
- version: 1.3.9
58
- type: :development
37
+ version: 3.1.3
38
+ type: :runtime
59
39
  prerelease: false
60
40
  version_requirements: !ruby/object:Gem::Requirement
61
41
  requirements:
62
42
  - - "~>"
63
43
  - !ruby/object:Gem::Version
64
- version: '1.3'
44
+ version: '3.1'
65
45
  - - ">="
66
46
  - !ruby/object:Gem::Version
67
- version: 1.3.9
47
+ version: 3.1.3
68
48
  - !ruby/object:Gem::Dependency
69
- name: factory_girl
49
+ name: sqlite3
70
50
  requirement: !ruby/object:Gem::Requirement
71
51
  requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '4.4'
75
52
  - - ">="
76
53
  - !ruby/object:Gem::Version
77
- version: 4.4.0
54
+ version: '0'
78
55
  type: :development
79
56
  prerelease: false
80
57
  version_requirements: !ruby/object:Gem::Requirement
81
58
  requirements:
82
- - - "~>"
83
- - !ruby/object:Gem::Version
84
- version: '4.4'
85
59
  - - ">="
86
60
  - !ruby/object:Gem::Version
87
- version: 4.4.0
61
+ version: '0'
88
62
  description: A Rails authentication plugin that takes a minimalist approach. It is
89
63
  designed to be simple to understand, use, and modify for your application.
90
64
  email:
91
- - developers@wwidea.org
65
+ - baldwina@brightwayslearning.org
92
66
  executables: []
93
67
  extensions: []
94
68
  extra_rdoc_files: []
95
69
  files:
96
- - ".gitignore"
97
- - Gemfile
98
- - Gemfile.lock
99
70
  - MIT-LICENSE
100
71
  - README.md
101
72
  - Rakefile
102
- - lib/app/views/sessions/_form.html.erb
103
- - lib/app/views/sessions/new.html.erb
73
+ - app/assets/config/minimalist_authentication_manifest.js
74
+ - app/views/sessions/_form.html.erb
75
+ - app/views/sessions/new.html.erb
76
+ - config/routes.rb
104
77
  - lib/minimalist/authentication.rb
105
78
  - lib/minimalist/authorization.rb
106
79
  - lib/minimalist/sessions.rb
107
80
  - lib/minimalist/test_helper.rb
108
- - lib/minimalist/version.rb
109
81
  - lib/minimalist_authentication.rb
82
+ - lib/minimalist_authentication/engine.rb
83
+ - lib/minimalist_authentication/version.rb
110
84
  - lib/tasks/minimalist_authentication_tasks.rake
111
- - minimalist_authentication.gemspec
112
- - test/.gitignore
113
- - test/authentication_test.rb
114
- - test/authorization_test.rb
115
- - test/factories.rb
116
- - test/jenkins.bash
117
- - test/rails_root/README
118
- - test/rails_root/Rakefile
119
- - test/rails_root/app/controllers/application_controller.rb
120
- - test/rails_root/app/controllers/sessions_controller.rb
121
- - test/rails_root/app/helpers/application_helper.rb
122
- - test/rails_root/app/models/user.rb
123
- - test/rails_root/app/views/layouts/application.html.erb
124
- - test/rails_root/config.ru
125
- - test/rails_root/config/application.rb
126
- - test/rails_root/config/boot.rb
127
- - test/rails_root/config/database.yml
128
- - test/rails_root/config/environment.rb
129
- - test/rails_root/config/environments/development.rb
130
- - test/rails_root/config/environments/production.rb
131
- - test/rails_root/config/environments/test.rb
132
- - test/rails_root/config/initializers/backtrace_silencers.rb
133
- - test/rails_root/config/initializers/inflections.rb
134
- - test/rails_root/config/initializers/mime_types.rb
135
- - test/rails_root/config/initializers/secret_token.rb
136
- - test/rails_root/config/initializers/session_store.rb
137
- - test/rails_root/config/locales/en.yml
138
- - test/rails_root/config/routes.rb
139
- - test/rails_root/db/.gitignore
140
- - test/rails_root/db/schema.rb
141
- - test/rails_root/db/seeds.rb
142
- - test/rails_root/doc/README_FOR_APP
143
- - test/rails_root/lib/tasks/.gitkeep
144
- - test/rails_root/log/.gitignore
145
- - test/rails_root/log/.gitkeep
146
- - test/rails_root/script/rails
147
- - test/rails_root/test/performance/browsing_test.rb
148
- - test/rails_root/test/test_helper.rb
149
- - test/sessions_test.rb
150
- - test/test_helper.rb
151
85
  homepage: https://github.com/wwidea/minimalist_authentication
152
86
  licenses:
153
87
  - MIT
@@ -168,46 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
102
  version: '0'
169
103
  requirements: []
170
104
  rubyforge_project:
171
- rubygems_version: 2.4.8
105
+ rubygems_version: 2.6.12
172
106
  signing_key:
173
107
  specification_version: 4
174
108
  summary: A Rails authentication plugin that takes a minimalist approach.
175
- test_files:
176
- - test/authentication_test.rb
177
- - test/authorization_test.rb
178
- - test/factories.rb
179
- - test/jenkins.bash
180
- - test/rails_root/README
181
- - test/rails_root/Rakefile
182
- - test/rails_root/app/controllers/application_controller.rb
183
- - test/rails_root/app/controllers/sessions_controller.rb
184
- - test/rails_root/app/helpers/application_helper.rb
185
- - test/rails_root/app/models/user.rb
186
- - test/rails_root/app/views/layouts/application.html.erb
187
- - test/rails_root/config.ru
188
- - test/rails_root/config/application.rb
189
- - test/rails_root/config/boot.rb
190
- - test/rails_root/config/database.yml
191
- - test/rails_root/config/environment.rb
192
- - test/rails_root/config/environments/development.rb
193
- - test/rails_root/config/environments/production.rb
194
- - test/rails_root/config/environments/test.rb
195
- - test/rails_root/config/initializers/backtrace_silencers.rb
196
- - test/rails_root/config/initializers/inflections.rb
197
- - test/rails_root/config/initializers/mime_types.rb
198
- - test/rails_root/config/initializers/secret_token.rb
199
- - test/rails_root/config/initializers/session_store.rb
200
- - test/rails_root/config/locales/en.yml
201
- - test/rails_root/config/routes.rb
202
- - test/rails_root/db/.gitignore
203
- - test/rails_root/db/schema.rb
204
- - test/rails_root/db/seeds.rb
205
- - test/rails_root/doc/README_FOR_APP
206
- - test/rails_root/lib/tasks/.gitkeep
207
- - test/rails_root/log/.gitignore
208
- - test/rails_root/log/.gitkeep
209
- - test/rails_root/script/rails
210
- - test/rails_root/test/performance/browsing_test.rb
211
- - test/rails_root/test/test_helper.rb
212
- - test/sessions_test.rb
213
- - test/test_helper.rb
109
+ test_files: []
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- coverage
2
- .svn
3
- .loadpath
4
- .project
5
- .redcar
6
- *.gem
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
data/Gemfile.lock DELETED
@@ -1,101 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- minimalist_authentication (0.6.14)
5
- bcrypt (~> 3.1, >= 3.1.3)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actionmailer (3.2.14)
11
- actionpack (= 3.2.14)
12
- mail (~> 2.5.4)
13
- actionpack (3.2.14)
14
- activemodel (= 3.2.14)
15
- activesupport (= 3.2.14)
16
- builder (~> 3.0.0)
17
- erubis (~> 2.7.0)
18
- journey (~> 1.0.4)
19
- rack (~> 1.4.5)
20
- rack-cache (~> 1.2)
21
- rack-test (~> 0.6.1)
22
- sprockets (~> 2.2.1)
23
- activemodel (3.2.14)
24
- activesupport (= 3.2.14)
25
- builder (~> 3.0.0)
26
- activerecord (3.2.14)
27
- activemodel (= 3.2.14)
28
- activesupport (= 3.2.14)
29
- arel (~> 3.0.2)
30
- tzinfo (~> 0.3.29)
31
- activeresource (3.2.14)
32
- activemodel (= 3.2.14)
33
- activesupport (= 3.2.14)
34
- activesupport (3.2.14)
35
- i18n (~> 0.6, >= 0.6.4)
36
- multi_json (~> 1.0)
37
- arel (3.0.3)
38
- bcrypt (3.1.11)
39
- builder (3.0.4)
40
- erubis (2.7.0)
41
- factory_girl (4.5.0)
42
- activesupport (>= 3.0.0)
43
- hike (1.2.3)
44
- i18n (0.7.0)
45
- journey (1.0.4)
46
- json (1.8.2)
47
- mail (2.5.4)
48
- mime-types (~> 1.16)
49
- treetop (~> 1.4.8)
50
- mime-types (1.25.1)
51
- multi_json (1.10.1)
52
- polyglot (0.3.5)
53
- rack (1.4.5)
54
- rack-cache (1.2)
55
- rack (>= 0.4)
56
- rack-ssl (1.3.4)
57
- rack
58
- rack-test (0.6.3)
59
- rack (>= 1.0)
60
- rails (3.2.14)
61
- actionmailer (= 3.2.14)
62
- actionpack (= 3.2.14)
63
- activerecord (= 3.2.14)
64
- activeresource (= 3.2.14)
65
- activesupport (= 3.2.14)
66
- bundler (~> 1.0)
67
- railties (= 3.2.14)
68
- railties (3.2.14)
69
- actionpack (= 3.2.14)
70
- activesupport (= 3.2.14)
71
- rack-ssl (~> 1.3.2)
72
- rake (>= 0.8.7)
73
- rdoc (~> 3.4)
74
- thor (>= 0.14.6, < 2.0)
75
- rake (10.4.2)
76
- rdoc (3.12.2)
77
- json (~> 1.4)
78
- sprockets (2.2.3)
79
- hike (~> 1.2)
80
- multi_json (~> 1.0)
81
- rack (~> 1.0)
82
- tilt (~> 1.1, != 1.3.0)
83
- sqlite3 (1.3.10)
84
- thor (0.19.1)
85
- tilt (1.4.1)
86
- treetop (1.4.15)
87
- polyglot
88
- polyglot (>= 0.3.1)
89
- tzinfo (0.3.43)
90
-
91
- PLATFORMS
92
- ruby
93
-
94
- DEPENDENCIES
95
- factory_girl (~> 4.4, >= 4.4.0)
96
- minimalist_authentication!
97
- rails (= 3.2.14)
98
- sqlite3 (~> 1.3, >= 1.3.9)
99
-
100
- BUNDLED WITH
101
- 1.11.2