devise_password_expirable 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/devise/password_expired_controller.rb +1 -0
- data/lib/devise_password_expirable.rb +1 -0
- data/lib/devise_password_expirable/models/database_authenticatable_patch.rb +25 -0
- data/lib/devise_password_expirable/models/password_expirable.rb +1 -1
- data/lib/devise_password_expirable/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA512:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9944d2b6c7e8512cca6d6501d31c29f023453f22928f8aa8b8b03902b4b7fb8f177d5a4b866edb7520c13f9298a43ed285745462bb518cb45bcc9863006dca2c
|
4
|
+
data.tar.gz: f5d70c53144e98922ab83a52515d37f435fc25a1ef39fedef01772be6345302b57821e57604c71f4f6f6fbdd3862a6b3db421255f49339067c15c85b36346751
|
5
5
|
SHA1:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 470d49468aadb9d9870aca2d3884a953ea00a89e
|
7
|
+
data.tar.gz: 56596cbc457b4f930d800dbfe1e6d6445cc5a5bc
|
@@ -12,6 +12,7 @@ class Devise::PasswordExpiredController < ApplicationController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def update
|
15
|
+
resource.extend(Devise::Models::DatabaseAuthenticatablePatch)
|
15
16
|
if resource.update_with_password(params[resource_name])
|
16
17
|
warden.session(scope)[:password_expired] = false
|
17
18
|
set_flash_message :notice, :updated
|
@@ -29,3 +29,4 @@ Devise.add_module :password_expirable, :controller => :password_expirable, :mode
|
|
29
29
|
require 'devise_password_expirable/routes'
|
30
30
|
require 'devise_password_expirable/rails'
|
31
31
|
require 'devise_password_expirable/orm/active_record'
|
32
|
+
require 'devise_password_expirable/models/database_authenticatable_patch'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Devise
|
2
|
+
module Models
|
3
|
+
module DatabaseAuthenticatablePatch
|
4
|
+
def update_with_password(params={})
|
5
|
+
current_password = params.delete(:current_password)
|
6
|
+
|
7
|
+
new_password = params[:password]
|
8
|
+
new_password_confirmation = params[:password_confirmation]
|
9
|
+
|
10
|
+
result = if valid_password?(current_password) && new_password.present? && new_password_confirmation.present?
|
11
|
+
update_attributes(params)
|
12
|
+
else
|
13
|
+
self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)
|
14
|
+
self.errors.add(:password, new_password.blank? ? :blank : :invalid)
|
15
|
+
self.errors.add(:password_confirmation, new_password_confirmation.blank? ? :blank : :invalid)
|
16
|
+
self.attributes = params
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
clean_up_passwords
|
21
|
+
result
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -48,7 +48,7 @@ module Devise # :nodoc:
|
|
48
48
|
|
49
49
|
private
|
50
50
|
|
51
|
-
# is password changed then update
|
51
|
+
# is password changed then update password_changed_at
|
52
52
|
def update_password_changed
|
53
53
|
self.last_password_reset = Time.now if (self.new_record? or self.encrypted_password_changed?) and not self.last_password_reset_changed?
|
54
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_password_expirable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jenni Kissinger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-12 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/devise_password_expirable.rb
|
65
65
|
- lib/devise_password_expirable/controllers/helpers.rb
|
66
66
|
- lib/devise_password_expirable/hooks/password_expirable.rb
|
67
|
+
- lib/devise_password_expirable/models/database_authenticatable_patch.rb
|
67
68
|
- lib/devise_password_expirable/models/password_expirable.rb
|
68
69
|
- lib/devise_password_expirable/orm/active_record.rb
|
69
70
|
- lib/devise_password_expirable/rails.rb
|