quo_vadis 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## 1.2.2 (20 March 2013)
5
+
6
+ * Enable form validation errors in activation form.
7
+ * Increase time limit for password reset / activation to 24hr.
8
+
9
+
4
10
  ## 1.2.1 (15 August 2012)
5
11
 
6
12
  * Ignore blank usenames when authenticating.
@@ -85,7 +85,11 @@ class QuoVadis::SessionsController < ApplicationController
85
85
 
86
86
  # GET invitation_path /sign-in/invite/:token
87
87
  def invite
88
- if (user = QuoVadis.model_class.valid_token(params[:token]).first)
88
+ if (@user = QuoVadis.model_class.valid_token(params[:token]).first)
89
+ # When we create a user who must activate their account, we give them
90
+ # a random username and password. However we want to treat them as if
91
+ # they weren't set at all.
92
+ @user.username = nil
89
93
  render 'sessions/invite'
90
94
  else
91
95
  invalid_token :activation
@@ -94,17 +98,18 @@ class QuoVadis::SessionsController < ApplicationController
94
98
 
95
99
  # POST activation_path /sign-in/accept/:token
96
100
  def accept
97
- if (user = QuoVadis.model_class.valid_token(params[:token]).first)
98
- user.username, user.password = params[:username], params[:password]
101
+ if (@user = QuoVadis.model_class.valid_token(params[:token]).first)
102
+ @user.username, @user.password = params[:username], params[:password]
99
103
  # When we create a user who must activate their account, we give them
100
104
  # a random username and password. However we want to treat them as if
101
105
  # they weren't set at all.
102
- user.password_digest = nil if params[:password].blank?
103
- if user.save
104
- user.clear_token
106
+ @user.password_digest = nil if params[:password].blank?
107
+ if @user.save
108
+ @user.clear_token
105
109
  flash_if_present :notice, 'quo_vadis.flash.activation.accepted'
106
- sign_in user
110
+ sign_in @user
107
111
  else
112
+ flash_if_present :alert, 'quo_vadis.flash.activation.invalid_credentials', :now
108
113
  render 'sessions/invite'
109
114
  end
110
115
  else
@@ -22,7 +22,7 @@ module ModelMixin
22
22
  validates :username, :presence => true, :uniqueness => true, :if => :should_authenticate?
23
23
  validates :password_digest, :presence => true, :if => :should_authenticate?
24
24
 
25
- scope :valid_token, lambda { |token| where("token = ? AND token_created_at > ?", token, 3.hours.ago) }
25
+ scope :valid_token, lambda { |token| where("token = ? AND token_created_at > ?", token, 24.hours.ago) }
26
26
 
27
27
  instance_eval <<-END, __FILE__, __LINE__ + 1
28
28
  # Returns the user with the given <tt>username</tt> if the given password is
@@ -19,3 +19,4 @@ en:
19
19
  activation:
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
+ invalid_credentials: "Sorry, we couldn't accept that username and/or password."
@@ -1,3 +1,3 @@
1
1
  module QuoVadis
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.2'
3
3
  end
@@ -3,7 +3,7 @@ Hello <%= @username %>,
3
3
  We've received a request to change your password. If this wasn't you,
4
4
  please ignore this email and your password will be left alone.
5
5
 
6
- If you do want to change your password, just click this link (valid for 3 hours):
6
+ If you do want to change your password, just click this link (valid for 24 hours):
7
7
  <%= @url %>
8
8
 
9
9
  Thanks!
@@ -1,6 +1,6 @@
1
1
  Hello <%= @user.name %>,
2
2
 
3
- You can activate your account by clicking this link (valid for 3 hours):
3
+ You can activate your account by clicking this link (valid for 24 hours):
4
4
  <%= @url %>
5
5
 
6
6
  <% if instance_variable_defined? :@foo %><%= @foo %><% end %>
@@ -13,3 +13,19 @@
13
13
  <%= submit_tag 'Save my details' %>
14
14
  </p>
15
15
  <% end %>
16
+
17
+ <!-- OR, to use Rails' form validation helpers:
18
+ <%= form_for @user, url: activation_path(params[:token]), html: {method: :post} do |f| %>
19
+ <p>
20
+ <%= label_tag :password %>
21
+ <%= f.text_field :username, name: 'username' %>
22
+ </p>
23
+ <p>
24
+ <%= label_tag :password %>
25
+ <%= f.password_field :password, name: 'password' %>
26
+ </p>
27
+ <p>
28
+ <%= submit_tag 'Save my details' %>
29
+ </p>
30
+ <% end %>
31
+ -->
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quo_vadis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-15 00:00:00.000000000 Z
12
+ date: 2013-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2153649880 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153649880
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: bcrypt-ruby
27
- requirement: &2153648320 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 3.0.0
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *2153648320
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 3.0.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rails
38
- requirement: &2153836680 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 3.0.4
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2153836680
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.4
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: sqlite3-ruby
49
- requirement: &2153834960 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *2153834960
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: capybara
60
- requirement: &2153833160 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '1.1'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *2153833160
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '1.1'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: launchy
71
- requirement: &2153832240 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *2153832240
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: rake
82
- requirement: &2153831680 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,7 +117,12 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *2153831680
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  description: Simple username/password authentication for Rails 3.
92
127
  email:
93
128
  - boss@airbladesoftware.com
@@ -202,7 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
237
  version: '0'
203
238
  segments:
204
239
  - 0
205
- hash: -1701755491190668826
240
+ hash: -1859986741885625298
206
241
  required_rubygems_version: !ruby/object:Gem::Requirement
207
242
  none: false
208
243
  requirements:
@@ -211,10 +246,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
246
  version: '0'
212
247
  segments:
213
248
  - 0
214
- hash: -1701755491190668826
249
+ hash: -1859986741885625298
215
250
  requirements: []
216
251
  rubyforge_project: quo_vadis
217
- rubygems_version: 1.8.11
252
+ rubygems_version: 1.8.23
218
253
  signing_key:
219
254
  specification_version: 3
220
255
  summary: Simple username/password authentication for Rails 3.