adva_user 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README +114 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/adva_user.gemspec +17 -0
- data/app/controllers/admin/base_account_controller.rb +13 -0
- data/app/controllers/admin/users_controller.rb +95 -0
- data/app/controllers/password_controller.rb +36 -0
- data/app/controllers/session_controller.rb +30 -0
- data/app/helpers/users_helper.rb +27 -0
- data/app/models/account.rb +7 -0
- data/app/models/membership.rb +16 -0
- data/app/models/password_mailer.rb +43 -0
- data/app/models/user.rb +106 -0
- data/app/views/admin/users/_form.html.erb +29 -0
- data/app/views/admin/users/_sidebar.html.erb +8 -0
- data/app/views/admin/users/edit.html.erb +7 -0
- data/app/views/admin/users/index.html.erb +13 -0
- data/app/views/admin/users/new.html.erb +5 -0
- data/app/views/admin/users/show.html.erb +27 -0
- data/app/views/layouts/login.html.erb +24 -0
- data/app/views/password/edit.html.erb +14 -0
- data/app/views/password/new.html.erb +13 -0
- data/app/views/password_mailer/reset_password_email.html.erb +3 -0
- data/app/views/password_mailer/updated_password_email.html.erb +1 -0
- data/app/views/session/new.html.erb +17 -0
- data/config/initializers/menus.rb +25 -0
- data/config/routes.rb +14 -0
- data/db/migrate/20080402000001_create_users_table.rb +33 -0
- data/db/migrate/20080402000005_create_memberships_table.rb +13 -0
- data/db/migrate/20090625124502_create_accounts.rb +13 -0
- data/db/migrate/20090625133231_add_account_to_user.rb +10 -0
- data/lib/action_controller/authenticate_anonymous.rb +70 -0
- data/lib/action_controller/authenticate_user.rb +201 -0
- data/lib/active_record/belongs_to_author.rb +37 -0
- data/lib/adva_user.rb +28 -0
- data/lib/adva_user/version.rb +3 -0
- data/lib/login/helper_integration.rb +11 -0
- data/lib/login/mail_config.rb +39 -0
- data/test/contexts.rb +42 -0
- data/test/fixtures.rb +18 -0
- data/test/functional/admin/users_controller_test.rb +176 -0
- data/test/functional/password_controller_test.rb +96 -0
- data/test/functional/session_controller_test.rb +1 -0
- data/test/functional/user_controller_test.rb +95 -0
- data/test/integration/anonymous_login_test.rb +39 -0
- data/test/integration/edit_user_test.rb +44 -0
- data/test/integration/memberships_test.rb +52 -0
- data/test/integration/user_deletion_test.rb +27 -0
- data/test/integration/user_login_test.rb +53 -0
- data/test/integration/user_login_with_remember_me_test.rb +20 -0
- data/test/integration/user_registration_test.rb +64 -0
- data/test/test_helper.rb +1 -0
- data/test/unit/cells/user_cell_test.rb +13 -0
- data/test/unit/helpers/users_helper_test.rb +52 -0
- data/test/unit/models/account_test.rb +21 -0
- data/test/unit/models/anonymous_test.rb +54 -0
- data/test/unit/models/password_mailer_test.rb +26 -0
- data/test/unit/models/user_mailer_test.rb +16 -0
- data/test/unit/models/user_test.rb +173 -0
- data/vendor/gems/authentication/.gitignore +17 -0
- data/vendor/gems/authentication/Gemfile +4 -0
- data/vendor/gems/authentication/LICENSE +22 -0
- data/vendor/gems/authentication/MIT-LICENSE +38 -0
- data/vendor/gems/authentication/README +39 -0
- data/vendor/gems/authentication/README.md +29 -0
- data/vendor/gems/authentication/RUNNING_UNIT_TESTS +13 -0
- data/vendor/gems/authentication/Rakefile +61 -0
- data/vendor/gems/authentication/authentication.gemspec +17 -0
- data/vendor/gems/authentication/lib/authentication.rb +270 -0
- data/vendor/gems/authentication/lib/authentication/active_record_extensions.rb +11 -0
- data/vendor/gems/authentication/lib/authentication/bogus.rb +13 -0
- data/vendor/gems/authentication/lib/authentication/hash_helper.rb +26 -0
- data/vendor/gems/authentication/lib/authentication/ldap.rb +49 -0
- data/vendor/gems/authentication/lib/authentication/remember_me.rb +52 -0
- data/vendor/gems/authentication/lib/authentication/salted_hash.rb +53 -0
- data/vendor/gems/authentication/lib/authentication/single_token.rb +53 -0
- data/vendor/gems/authentication/lib/authentication/version.rb +3 -0
- data/vendor/gems/authentication/lib/radius/dictionary +207 -0
- data/vendor/gems/authentication/test_backup/abstract_unit.rb +30 -0
- data/vendor/gems/authentication/test_backup/active_record_extension_test.rb +17 -0
- data/vendor/gems/authentication/test_backup/authentication_test.rb +231 -0
- data/vendor/gems/authentication/test_backup/database.yml +12 -0
- data/vendor/gems/authentication/test_backup/fixtures/user.rb +3 -0
- data/vendor/gems/authentication/test_backup/fixtures/users.yml +3 -0
- data/vendor/gems/authentication/test_backup/options_test.rb +100 -0
- data/vendor/gems/authentication/test_backup/remember_me_test.rb +41 -0
- data/vendor/gems/authentication/test_backup/salted_hash_test.rb +38 -0
- data/vendor/gems/authentication/test_backup/schema.rb +10 -0
- data/vendor/gems/authentication/test_backup/single_token_test.rb +44 -0
- data/vendor/gems/authentication/test_backup/test_helper.rb +8 -0
- metadata +157 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
create_table :users, :force => true do |t|
|
3
|
+
t.column :name, :string, :null => false
|
4
|
+
t.column :password_hash, :string, :length => 40
|
5
|
+
t.column :password_salt, :string, :length => 40
|
6
|
+
t.column :token_key, :string, :length => 40
|
7
|
+
t.column :token_expiration, :datetime
|
8
|
+
t.column :remember_me, :string, :length => 40
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.join(File.dirname(__FILE__), 'abstract_unit')
|
3
|
+
|
4
|
+
# Tests SingleToken to see if it can allocate tokens and validate
|
5
|
+
# those tokens correctly
|
6
|
+
class SingleTokenTest < Test::Unit::TestCase
|
7
|
+
include Authentication::HashHelper
|
8
|
+
fixtures :users
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@tokener = Authentication::SingleToken.new
|
12
|
+
|
13
|
+
@joe = users(:joe)
|
14
|
+
@key = @tokener.assign_token @joe, 'standard', 3.days.from_now
|
15
|
+
@joe.save!
|
16
|
+
@joe.reload
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_assign_token
|
20
|
+
assert_equal hash_string(@key), @joe.token_key
|
21
|
+
assert_equal 3.days.from_now.to_date, @joe.token_expiration.to_date
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_authenticate
|
25
|
+
assert @tokener.authenticate(@joe, @key)
|
26
|
+
assert !@tokener.authenticate(@joe, "invalid key")
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_expired_token
|
30
|
+
expired_key = @tokener.assign_token @joe, 'past', 1.day.ago
|
31
|
+
@joe.save!
|
32
|
+
@joe.reload
|
33
|
+
|
34
|
+
assert !@tokener.authenticate(@joe, expired_key)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_token_without_expiration
|
38
|
+
no_exp_key = @tokener.assign_token @joe, 'no_exp', nil
|
39
|
+
@joe.save!
|
40
|
+
@joe.reload
|
41
|
+
|
42
|
+
assert @tokener.authenticate(@joe, no_exp_key)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Plugin specific configuration and helper functions
|
2
|
+
class Test::Unit::TestCase
|
3
|
+
# Turn off transactional fixtures if you're working with MyISAM tables in MySQL
|
4
|
+
self.use_transactional_fixtures = false
|
5
|
+
|
6
|
+
# Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
|
7
|
+
self.use_instantiated_fixtures = false
|
8
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: adva_user
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Micah Geisel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Adva User
|
14
|
+
email:
|
15
|
+
- micah@botandrose.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- LICENSE
|
23
|
+
- README
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- adva_user.gemspec
|
27
|
+
- app/controllers/admin/base_account_controller.rb
|
28
|
+
- app/controllers/admin/users_controller.rb
|
29
|
+
- app/controllers/password_controller.rb
|
30
|
+
- app/controllers/session_controller.rb
|
31
|
+
- app/helpers/users_helper.rb
|
32
|
+
- app/models/account.rb
|
33
|
+
- app/models/membership.rb
|
34
|
+
- app/models/password_mailer.rb
|
35
|
+
- app/models/user.rb
|
36
|
+
- app/views/admin/users/_form.html.erb
|
37
|
+
- app/views/admin/users/_sidebar.html.erb
|
38
|
+
- app/views/admin/users/edit.html.erb
|
39
|
+
- app/views/admin/users/index.html.erb
|
40
|
+
- app/views/admin/users/new.html.erb
|
41
|
+
- app/views/admin/users/show.html.erb
|
42
|
+
- app/views/layouts/login.html.erb
|
43
|
+
- app/views/password/edit.html.erb
|
44
|
+
- app/views/password/new.html.erb
|
45
|
+
- app/views/password_mailer/reset_password_email.html.erb
|
46
|
+
- app/views/password_mailer/updated_password_email.html.erb
|
47
|
+
- app/views/session/new.html.erb
|
48
|
+
- config/initializers/menus.rb
|
49
|
+
- config/routes.rb
|
50
|
+
- db/migrate/20080402000001_create_users_table.rb
|
51
|
+
- db/migrate/20080402000005_create_memberships_table.rb
|
52
|
+
- db/migrate/20090625124502_create_accounts.rb
|
53
|
+
- db/migrate/20090625133231_add_account_to_user.rb
|
54
|
+
- lib/action_controller/authenticate_anonymous.rb
|
55
|
+
- lib/action_controller/authenticate_user.rb
|
56
|
+
- lib/active_record/belongs_to_author.rb
|
57
|
+
- lib/adva_user.rb
|
58
|
+
- lib/adva_user/version.rb
|
59
|
+
- lib/login/helper_integration.rb
|
60
|
+
- lib/login/mail_config.rb
|
61
|
+
- test/contexts.rb
|
62
|
+
- test/fixtures.rb
|
63
|
+
- test/functional/admin/users_controller_test.rb
|
64
|
+
- test/functional/password_controller_test.rb
|
65
|
+
- test/functional/session_controller_test.rb
|
66
|
+
- test/functional/user_controller_test.rb
|
67
|
+
- test/integration/anonymous_login_test.rb
|
68
|
+
- test/integration/edit_user_test.rb
|
69
|
+
- test/integration/memberships_test.rb
|
70
|
+
- test/integration/user_deletion_test.rb
|
71
|
+
- test/integration/user_login_test.rb
|
72
|
+
- test/integration/user_login_with_remember_me_test.rb
|
73
|
+
- test/integration/user_registration_test.rb
|
74
|
+
- test/test_helper.rb
|
75
|
+
- test/unit/cells/user_cell_test.rb
|
76
|
+
- test/unit/helpers/users_helper_test.rb
|
77
|
+
- test/unit/models/account_test.rb
|
78
|
+
- test/unit/models/anonymous_test.rb
|
79
|
+
- test/unit/models/password_mailer_test.rb
|
80
|
+
- test/unit/models/user_mailer_test.rb
|
81
|
+
- test/unit/models/user_test.rb
|
82
|
+
- vendor/gems/authentication/.gitignore
|
83
|
+
- vendor/gems/authentication/Gemfile
|
84
|
+
- vendor/gems/authentication/LICENSE
|
85
|
+
- vendor/gems/authentication/MIT-LICENSE
|
86
|
+
- vendor/gems/authentication/README
|
87
|
+
- vendor/gems/authentication/README.md
|
88
|
+
- vendor/gems/authentication/RUNNING_UNIT_TESTS
|
89
|
+
- vendor/gems/authentication/Rakefile
|
90
|
+
- vendor/gems/authentication/authentication.gemspec
|
91
|
+
- vendor/gems/authentication/lib/authentication.rb
|
92
|
+
- vendor/gems/authentication/lib/authentication/active_record_extensions.rb
|
93
|
+
- vendor/gems/authentication/lib/authentication/bogus.rb
|
94
|
+
- vendor/gems/authentication/lib/authentication/hash_helper.rb
|
95
|
+
- vendor/gems/authentication/lib/authentication/ldap.rb
|
96
|
+
- vendor/gems/authentication/lib/authentication/remember_me.rb
|
97
|
+
- vendor/gems/authentication/lib/authentication/salted_hash.rb
|
98
|
+
- vendor/gems/authentication/lib/authentication/single_token.rb
|
99
|
+
- vendor/gems/authentication/lib/authentication/version.rb
|
100
|
+
- vendor/gems/authentication/lib/radius/dictionary
|
101
|
+
- vendor/gems/authentication/test_backup/abstract_unit.rb
|
102
|
+
- vendor/gems/authentication/test_backup/active_record_extension_test.rb
|
103
|
+
- vendor/gems/authentication/test_backup/authentication_test.rb
|
104
|
+
- vendor/gems/authentication/test_backup/database.yml
|
105
|
+
- vendor/gems/authentication/test_backup/fixtures/user.rb
|
106
|
+
- vendor/gems/authentication/test_backup/fixtures/users.yml
|
107
|
+
- vendor/gems/authentication/test_backup/options_test.rb
|
108
|
+
- vendor/gems/authentication/test_backup/remember_me_test.rb
|
109
|
+
- vendor/gems/authentication/test_backup/salted_hash_test.rb
|
110
|
+
- vendor/gems/authentication/test_backup/schema.rb
|
111
|
+
- vendor/gems/authentication/test_backup/single_token_test.rb
|
112
|
+
- vendor/gems/authentication/test_backup/test_helper.rb
|
113
|
+
homepage: ''
|
114
|
+
licenses: []
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.4.6
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: Engine for Adva CMS user accounts
|
136
|
+
test_files:
|
137
|
+
- test/contexts.rb
|
138
|
+
- test/fixtures.rb
|
139
|
+
- test/functional/admin/users_controller_test.rb
|
140
|
+
- test/functional/password_controller_test.rb
|
141
|
+
- test/functional/session_controller_test.rb
|
142
|
+
- test/functional/user_controller_test.rb
|
143
|
+
- test/integration/anonymous_login_test.rb
|
144
|
+
- test/integration/edit_user_test.rb
|
145
|
+
- test/integration/memberships_test.rb
|
146
|
+
- test/integration/user_deletion_test.rb
|
147
|
+
- test/integration/user_login_test.rb
|
148
|
+
- test/integration/user_login_with_remember_me_test.rb
|
149
|
+
- test/integration/user_registration_test.rb
|
150
|
+
- test/test_helper.rb
|
151
|
+
- test/unit/cells/user_cell_test.rb
|
152
|
+
- test/unit/helpers/users_helper_test.rb
|
153
|
+
- test/unit/models/account_test.rb
|
154
|
+
- test/unit/models/anonymous_test.rb
|
155
|
+
- test/unit/models/password_mailer_test.rb
|
156
|
+
- test/unit/models/user_mailer_test.rb
|
157
|
+
- test/unit/models/user_test.rb
|