quo_vadis 1.3.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +21 -0
- data/README.md +1 -1
- data/Rakefile +1 -9
- data/app/mailers/quo_vadis/notifier.rb +3 -3
- data/app/models/model_mixin.rb +14 -6
- data/config/locales/quo_vadis.en.yml +6 -0
- data/lib/quo_vadis.rb +0 -8
- data/lib/quo_vadis/version.rb +1 -1
- data/quo_vadis.gemspec +5 -4
- data/test/dummy/app/views/layouts/application.html.erb +0 -2
- data/test/dummy/config/initializers/quo_vadis.rb +0 -7
- data/test/integration/config_test.rb +0 -14
- data/test/test_helper.rb +0 -2
- metadata +49 -65
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0dee59600eb3e1e3dc8110ca0c42d25594d01677
|
4
|
+
data.tar.gz: aeb164c5593a7640c0af0ead8398da99def841b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 174aab836f3fd1e89a8f2bff303dcae413e2567e0174bed21bb195c18c0fd76eaef3d9c541239ada7f1ac747bea1c7424ebfccd9f410855b134dc316cbd91ccd
|
7
|
+
data.tar.gz: 69871c9b4b3344786638d8b17131810f860f05d5fbbf4112c1cf08a65a6442989158fda6de3cdf9ba933e05c952f054056927426fb536d031d0cbf7a1a58fc2d
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,27 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
3
|
|
4
|
+
## 1.4.0 (12 October 2016)
|
5
|
+
|
6
|
+
* Internationalise emails' subject lines.
|
7
|
+
|
8
|
+
|
9
|
+
## 1.3.2 (22 July 2015)
|
10
|
+
|
11
|
+
* Loosen Rails dependency.
|
12
|
+
* Remove unnecessary code from test app.
|
13
|
+
|
14
|
+
|
15
|
+
## 1.3.1 (22 July 2015)
|
16
|
+
|
17
|
+
* Prefer an instance method to prepare for activation.
|
18
|
+
|
19
|
+
|
20
|
+
## 1.3.0 (23 May 2013)
|
21
|
+
|
22
|
+
* Validate username's uniqueness case-insensitively.
|
23
|
+
|
24
|
+
|
4
25
|
## 1.2.3 (21 March 2013)
|
5
26
|
|
6
27
|
* Ability to override the activation email's from and subject.
|
data/README.md
CHANGED
@@ -161,7 +161,7 @@ Write the mailer view, i.e. the email which will be sent to your new users ([exa
|
|
161
161
|
* be at `app/views/quo_vadis/notifier/invite.text.erb`
|
162
162
|
* render `@url` somewhere (this is the link the user clicks to go to the invitation page)
|
163
163
|
|
164
|
-
You can also refer to `@user` in the email view, as well as any other data you pass to `invite_to_activate`. Note that passing `:from` and/or `:subject` in the hash to `invite_to_activate` overrides the default `QuoVadis.from` and/or `
|
164
|
+
You can also refer to `@user` in the email view, as well as any other data you pass to `invite_to_activate`. Note that passing `:from` and/or `:subject` in the hash to `invite_to_activate` overrides the default `QuoVadis.from` and/or `I18n.t('quo_vadis.notifier.invite.subject')` respectively.
|
165
165
|
|
166
166
|
Configure the email's from address in `config/initializers/quo_vadis.rb` (or pass in the data hash to `invite_to_activate`).
|
167
167
|
|
data/Rakefile
CHANGED
@@ -2,21 +2,13 @@ require 'bundler'
|
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
4
|
require 'rake/testtask'
|
5
|
-
require 'rake/rdoctask'
|
6
5
|
|
7
6
|
Rake::TestTask.new(:test) do |t|
|
8
7
|
t.libs << 'lib'
|
9
8
|
t.libs << 'test'
|
10
9
|
t.pattern = 'test/**/*_test.rb'
|
11
10
|
t.verbose = false
|
12
|
-
|
13
|
-
|
14
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
15
|
-
rdoc.rdoc_dir = 'rdoc'
|
16
|
-
rdoc.title = 'Quo Vadis'
|
17
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
18
|
-
rdoc.rdoc_files.include('README.md')
|
19
|
-
rdoc.rdoc_files.include('app/**/*.rb')
|
11
|
+
t.warning = false
|
20
12
|
end
|
21
13
|
|
22
14
|
task :default => :test
|
@@ -6,7 +6,7 @@ module QuoVadis
|
|
6
6
|
def change_password(user)
|
7
7
|
@username = user.username
|
8
8
|
@url = change_password_url user.token
|
9
|
-
mail :to => user.email, :from => QuoVadis.from, :subject =>
|
9
|
+
mail :to => user.email, :from => QuoVadis.from, :subject => I18n.t('quo_vadis.notifier.change_password.subject')
|
10
10
|
end
|
11
11
|
|
12
12
|
# Sends an email to <tt>user</tt> with a link to a page where they
|
@@ -20,8 +20,8 @@ module QuoVadis
|
|
20
20
|
@url = invitation_url user.token
|
21
21
|
|
22
22
|
from = data.delete(:from) || QuoVadis.from
|
23
|
-
subject = data.delete(:subject) ||
|
24
|
-
|
23
|
+
subject = data.delete(:subject) || I18n.t('quo_vadis.notifier.invite.subject')
|
24
|
+
|
25
25
|
data.each { |k,v| instance_variable_set :"@#{k}", v }
|
26
26
|
mail :to => user.email, :from => from, :subject => subject
|
27
27
|
end
|
data/app/models/model_mixin.rb
CHANGED
@@ -46,14 +46,12 @@ module ModelMixin
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
# Instantiates a user suitable for user-activation.
|
49
|
+
# [Deprecated] Instantiates a user suitable for user-activation.
|
50
|
+
#
|
51
|
+
# NOTE: use instance method `#randomise_credentials` instead.
|
50
52
|
def new_for_activation(attributes = nil)
|
51
53
|
user = new attributes
|
52
|
-
|
53
|
-
begin
|
54
|
-
user.username = SecureRandom.base64(10)
|
55
|
-
end while exists?(:username => user.username)
|
56
|
-
user.password = SecureRandom.base64(10)
|
54
|
+
user.randomise_credentials
|
57
55
|
user
|
58
56
|
end
|
59
57
|
END
|
@@ -66,6 +64,16 @@ module ModelMixin
|
|
66
64
|
true
|
67
65
|
end
|
68
66
|
|
67
|
+
# Sets the `username` and `password` to random values.
|
68
|
+
# Use this for a user who should authenticate where they need to activate
|
69
|
+
# themselves first.
|
70
|
+
def randomise_credentials
|
71
|
+
begin
|
72
|
+
self.username = SecureRandom.base64(10)
|
73
|
+
end while self.class.exists?(:username => username)
|
74
|
+
self.password = SecureRandom.base64(10)
|
75
|
+
end
|
76
|
+
|
69
77
|
def password=(plain_text_password) # :nodoc:
|
70
78
|
@password = plain_text_password
|
71
79
|
unless @password.blank?
|
@@ -20,3 +20,9 @@ en:
|
|
20
20
|
accepted: "Your account is active and you're now signed in."
|
21
21
|
invalid_token: "Sorry, this link isn't valid anymore."
|
22
22
|
invalid_credentials: "Sorry, we couldn't accept that username and/or password."
|
23
|
+
|
24
|
+
notifier:
|
25
|
+
change_password:
|
26
|
+
subject: Change your password
|
27
|
+
invite:
|
28
|
+
subject: Activate your account
|
data/lib/quo_vadis.rb
CHANGED
@@ -101,14 +101,6 @@ module QuoVadis
|
|
101
101
|
mattr_accessor :from
|
102
102
|
@@from = 'noreply@example.com'
|
103
103
|
|
104
|
-
# Subject of the forgotten-password email.
|
105
|
-
mattr_accessor :subject_change_password
|
106
|
-
@@subject_change_password = 'Change your password.'
|
107
|
-
|
108
|
-
# Subject of the invitation email.
|
109
|
-
mattr_accessor :subject_invitation
|
110
|
-
@@subject_invitation = 'Activate your account'
|
111
|
-
|
112
104
|
|
113
105
|
#
|
114
106
|
# Miscellaneous
|
data/lib/quo_vadis/version.rb
CHANGED
data/quo_vadis.gemspec
CHANGED
@@ -19,12 +19,13 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ['lib']
|
21
21
|
|
22
|
-
s.add_dependency 'rails', '
|
23
|
-
s.add_dependency 'bcrypt
|
22
|
+
s.add_dependency 'rails', '> 3.0.4', '< 5'
|
23
|
+
s.add_dependency 'bcrypt', '> 3.1.6'
|
24
24
|
|
25
|
-
s.add_development_dependency 'rails', '~>3.0.4' # so we can test CSRF protection
|
26
|
-
s.add_development_dependency 'sqlite3
|
25
|
+
# s.add_development_dependency 'rails', '~> 3.0.4' # so we can test CSRF protection
|
26
|
+
s.add_development_dependency 'sqlite3'
|
27
27
|
s.add_development_dependency 'capybara', '~>1.1'
|
28
28
|
s.add_development_dependency 'launchy'
|
29
29
|
s.add_development_dependency 'rake'
|
30
|
+
s.add_development_dependency 'test-unit', '~> 3.0'
|
30
31
|
end
|
@@ -67,13 +67,6 @@ QuoVadis.configure do |config|
|
|
67
67
|
# From whom the forgotten-password email should be sent.
|
68
68
|
config.from = 'noreply@example.com'
|
69
69
|
|
70
|
-
# Subject of the forgotten-password email.
|
71
|
-
config.subject_change_password = 'Change your password'
|
72
|
-
|
73
|
-
# Subject of the invitation email.
|
74
|
-
config.subject_invitation = 'Activate your account'
|
75
|
-
|
76
|
-
|
77
70
|
#
|
78
71
|
# Miscellaneous
|
79
72
|
#
|
@@ -115,18 +115,4 @@ class ConfigTest < ActiveSupport::IntegrationCase
|
|
115
115
|
assert_equal ['jim@example.com'], email.from
|
116
116
|
end
|
117
117
|
|
118
|
-
test 'change-password mailer subject config' do
|
119
|
-
QuoVadis.subject_change_password = 'You idiot!'
|
120
|
-
(user = User.last).generate_token
|
121
|
-
email = QuoVadis::Notifier.change_password(user)
|
122
|
-
assert_equal 'You idiot!', email.subject
|
123
|
-
end
|
124
|
-
|
125
|
-
test 'invitation mailer subject config' do
|
126
|
-
QuoVadis.subject_invitation = 'Wooha'
|
127
|
-
(user = User.last).generate_token
|
128
|
-
email = QuoVadis::Notifier.invite(user)
|
129
|
-
assert_equal 'Wooha', email.subject
|
130
|
-
end
|
131
|
-
|
132
118
|
end
|
data/test/test_helper.rb
CHANGED
@@ -56,8 +56,6 @@ def reset_quo_vadis_configuration
|
|
56
56
|
QuoVadis.signed_out_hook = nil
|
57
57
|
QuoVadis.layout = 'application'
|
58
58
|
QuoVadis.from = 'noreply@example.com'
|
59
|
-
QuoVadis.subject_change_password = 'Change your password'
|
60
|
-
QuoVadis.subject_invitation = 'Activate your account'
|
61
59
|
QuoVadis.remember_for = 2.weeks
|
62
60
|
QuoVadis.blocked = false
|
63
61
|
end
|
metadata
CHANGED
@@ -1,128 +1,119 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quo_vadis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.4.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andy Stewart
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2020-12-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: bcrypt-ruby
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
19
|
+
version: 3.0.4
|
20
|
+
- - "<"
|
36
21
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
22
|
+
version: '5'
|
38
23
|
type: :runtime
|
39
24
|
prerelease: false
|
40
25
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
26
|
requirements:
|
43
|
-
- -
|
27
|
+
- - ">"
|
44
28
|
- !ruby/object:Gem::Version
|
45
|
-
version: 3.0.
|
29
|
+
version: 3.0.4
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5'
|
46
33
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
34
|
+
name: bcrypt
|
48
35
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
36
|
requirements:
|
51
|
-
- -
|
37
|
+
- - ">"
|
52
38
|
- !ruby/object:Gem::Version
|
53
|
-
version: 3.
|
54
|
-
type: :
|
39
|
+
version: 3.1.6
|
40
|
+
type: :runtime
|
55
41
|
prerelease: false
|
56
42
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
43
|
requirements:
|
59
|
-
- -
|
44
|
+
- - ">"
|
60
45
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
46
|
+
version: 3.1.6
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: sqlite3
|
48
|
+
name: sqlite3
|
64
49
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
50
|
requirements:
|
67
|
-
- -
|
51
|
+
- - ">="
|
68
52
|
- !ruby/object:Gem::Version
|
69
53
|
version: '0'
|
70
54
|
type: :development
|
71
55
|
prerelease: false
|
72
56
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
57
|
requirements:
|
75
|
-
- -
|
58
|
+
- - ">="
|
76
59
|
- !ruby/object:Gem::Version
|
77
60
|
version: '0'
|
78
61
|
- !ruby/object:Gem::Dependency
|
79
62
|
name: capybara
|
80
63
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
64
|
requirements:
|
83
|
-
- - ~>
|
65
|
+
- - "~>"
|
84
66
|
- !ruby/object:Gem::Version
|
85
67
|
version: '1.1'
|
86
68
|
type: :development
|
87
69
|
prerelease: false
|
88
70
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
71
|
requirements:
|
91
|
-
- - ~>
|
72
|
+
- - "~>"
|
92
73
|
- !ruby/object:Gem::Version
|
93
74
|
version: '1.1'
|
94
75
|
- !ruby/object:Gem::Dependency
|
95
76
|
name: launchy
|
96
77
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
78
|
requirements:
|
99
|
-
- -
|
79
|
+
- - ">="
|
100
80
|
- !ruby/object:Gem::Version
|
101
81
|
version: '0'
|
102
82
|
type: :development
|
103
83
|
prerelease: false
|
104
84
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
85
|
requirements:
|
107
|
-
- -
|
86
|
+
- - ">="
|
108
87
|
- !ruby/object:Gem::Version
|
109
88
|
version: '0'
|
110
89
|
- !ruby/object:Gem::Dependency
|
111
90
|
name: rake
|
112
91
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
92
|
requirements:
|
115
|
-
- -
|
93
|
+
- - ">="
|
116
94
|
- !ruby/object:Gem::Version
|
117
95
|
version: '0'
|
118
96
|
type: :development
|
119
97
|
prerelease: false
|
120
98
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
99
|
requirements:
|
123
|
-
- -
|
100
|
+
- - ">="
|
124
101
|
- !ruby/object:Gem::Version
|
125
102
|
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: test-unit
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3.0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '3.0'
|
126
117
|
description: Simple username/password authentication for Rails 3.
|
127
118
|
email:
|
128
119
|
- boss@airbladesoftware.com
|
@@ -130,7 +121,7 @@ executables: []
|
|
130
121
|
extensions: []
|
131
122
|
extra_rdoc_files: []
|
132
123
|
files:
|
133
|
-
- .gitignore
|
124
|
+
- ".gitignore"
|
134
125
|
- CHANGELOG.md
|
135
126
|
- Gemfile
|
136
127
|
- README.md
|
@@ -225,33 +216,26 @@ files:
|
|
225
216
|
- test/unit/user_test.rb
|
226
217
|
homepage: https://github.com/airblade/quo_vadis
|
227
218
|
licenses: []
|
228
|
-
|
219
|
+
metadata: {}
|
220
|
+
post_install_message:
|
229
221
|
rdoc_options: []
|
230
222
|
require_paths:
|
231
223
|
- lib
|
232
224
|
required_ruby_version: !ruby/object:Gem::Requirement
|
233
|
-
none: false
|
234
225
|
requirements:
|
235
|
-
- -
|
226
|
+
- - ">="
|
236
227
|
- !ruby/object:Gem::Version
|
237
228
|
version: '0'
|
238
|
-
segments:
|
239
|
-
- 0
|
240
|
-
hash: 4418019699885663804
|
241
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
|
-
none: false
|
243
230
|
requirements:
|
244
|
-
- -
|
231
|
+
- - ">="
|
245
232
|
- !ruby/object:Gem::Version
|
246
233
|
version: '0'
|
247
|
-
segments:
|
248
|
-
- 0
|
249
|
-
hash: 4418019699885663804
|
250
234
|
requirements: []
|
251
235
|
rubyforge_project: quo_vadis
|
252
|
-
rubygems_version:
|
253
|
-
signing_key:
|
254
|
-
specification_version:
|
236
|
+
rubygems_version: 2.5.2.3
|
237
|
+
signing_key:
|
238
|
+
specification_version: 4
|
255
239
|
summary: Simple username/password authentication for Rails 3.
|
256
240
|
test_files:
|
257
241
|
- test/dummy/.gitignore
|