devise_password_expirable 0.0.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA512:
3
- metadata.gz: 2243f56dcf1b29259ac7b49d2c8a5bc220f5e88834d9bd8e86e461868a6d72882594f2db4e96814e7446b9cf01335b4654183dfc59f276576a5c794dbf660f1e
4
- data.tar.gz: 82b9fd866a813b251d7f74329fd86743f4f3c7d442aaf51e7eebb85b73fb9a220402ea0aea6f857f7d58c5e34f9c822375ecd9e771ee6fad746428a04ad3a890
5
2
  SHA1:
6
- metadata.gz: bccf0aed784f474be00d376648b432a4d874bab8
7
- data.tar.gz: 03cd74b9e271eca84c10701f4eef3543f0a5b81c
3
+ metadata.gz: 70fc5272c1ac92d630c671d721b99184c1342ec8
4
+ data.tar.gz: 8362a07d245706fd294046cb8f8247328f680968
5
+ SHA512:
6
+ metadata.gz: 4bc9804d2bb57c7d4c11a60e3993e6db31d4ceace44436d9a4043ace4dfbdd99cfbee082bdf83291e0aae877d1afbf95395b728d01b458101d00c152aaa0b09b
7
+ data.tar.gz: 6d4f83350082ed47e60adbdeb412b59811e08edfd534e0c25140f721f368fc7ea2d3fbd794856215cddd60b31d9e6127ee6e75c948cb667658a7aedbbf89e478
data/.document CHANGED
@@ -1,5 +1,5 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore CHANGED
@@ -1,20 +1,20 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
-
6
- # Temporary files of every sort
7
- .DS_Store
8
- .idea
9
- .rvmrc
10
- .stgit*
11
- *.swap
12
- *.swo
13
- *.swp
14
- *~
15
- bin/*
16
- nbproject
17
- patches-*
18
- capybara-*.html
19
- dump.rdb
20
- *.ids
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+
6
+ # Temporary files of every sort
7
+ .DS_Store
8
+ .idea
9
+ .rvmrc
10
+ .stgit*
11
+ *.swap
12
+ *.swo
13
+ *.swp
14
+ *~
15
+ bin/*
16
+ nbproject
17
+ patches-*
18
+ capybara-*.html
19
+ dump.rdb
20
+ *.ids
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in devise_ip_filter.gemspec
4
- gemspec
5
- gem "rails", ">= 3.0.20"
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in devise_ip_filter.gemspec
4
+ gemspec
5
+ gem "rails", ">= 3.0.20"
6
6
  gem "devise"
data/README.md CHANGED
@@ -1,31 +1,31 @@
1
- ## Expire passwords plugin for Devise
2
-
3
- This plugin expires user passwords after a set time period. The plugin assumes you have a column called "last_password_reset" in your table.
4
-
5
- ## Features
6
-
7
- * set the length of time after which passwords expire
8
-
9
- ## Configuration
10
-
11
- ### Initial Setup
12
-
13
- In a Rails environment, add the following line to your Gemfile:
14
-
15
- gem 'devise_password_expirable'
16
-
17
- From the command line, run:
18
-
19
- bundle install
20
-
21
- ### Installation
22
-
23
- To add the correct settings to your already-existing devise initializer, run this command in the command line:
24
-
25
- rails generate devise_password_expirable:install
26
-
27
- To enable the plugin, add
28
-
29
- :password_expirable
30
-
1
+ ## Expire passwords plugin for Devise
2
+
3
+ This plugin expires user passwords after a set time period. The plugin assumes you have a column called "last_password_reset" in your table.
4
+
5
+ ## Features
6
+
7
+ * set the length of time after which passwords expire
8
+
9
+ ## Configuration
10
+
11
+ ### Initial Setup
12
+
13
+ In a Rails environment, add the following line to your Gemfile:
14
+
15
+ gem 'devise_password_expirable'
16
+
17
+ From the command line, run:
18
+
19
+ bundle install
20
+
21
+ ### Installation
22
+
23
+ To add the correct settings to your already-existing devise initializer, run this command in the command line:
24
+
25
+ rails generate devise_password_expirable:install
26
+
27
+ To enable the plugin, add
28
+
29
+ :password_expirable
30
+
31
31
  to your model's devise parameters.
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require "bundler/gem_tasks"
@@ -1,37 +1,36 @@
1
- class Devise::PasswordExpiredController < ApplicationController
2
- skip_before_filter :handle_password_change
3
- prepend_before_filter :authenticate_scope!, :only => [:show, :update]
4
- include Devise::Controllers::InternalHelpers
5
-
6
- def show
7
- if not resource.nil? and resource.need_change_password?
8
- render_with_scope :show
9
- else
10
- redirect_to :root
11
- end
12
- end
13
-
14
- def update
15
- resource.extend(Devise::Models::DatabaseAuthenticatablePatch)
16
- if resource.update_with_password(params[resource_name])
17
- warden.session(scope)[:password_expired] = false
18
- set_flash_message :notice, :updated
19
- sign_in scope, resource
20
- redirect_to stored_location_for(scope) || :root
21
- else
22
- clean_up_passwords(resource)
23
- render_with_scope :show
24
- end
25
- end
26
-
27
- private
28
-
29
- def scope
30
- resource_name.to_sym
31
- end
32
-
33
- def authenticate_scope!
34
- send(:"authenticate_#{resource_name}!")
35
- self.resource = send("current_#{resource_name}")
36
- end
37
- end
1
+ class Devise::PasswordExpiredController < DeviseController
2
+ skip_before_filter :handle_password_change
3
+ prepend_before_filter :authenticate_scope!, :only => [:show, :update]
4
+
5
+ def show
6
+ if not resource.nil? and resource.need_change_password?
7
+ render_with_scope :show
8
+ else
9
+ redirect_to :root
10
+ end
11
+ end
12
+
13
+ def update
14
+ resource.extend(Devise::Models::DatabaseAuthenticatablePatch)
15
+ if resource.update_with_password(params[resource_name])
16
+ warden.session(scope)[:password_expired] = false
17
+ set_flash_message :notice, :updated
18
+ sign_in scope, resource
19
+ redirect_to stored_location_for(scope) || :root
20
+ else
21
+ clean_up_passwords(resource)
22
+ render_with_scope :show
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def scope
29
+ resource_name.to_sym
30
+ end
31
+
32
+ def authenticate_scope!
33
+ send(:"authenticate_#{resource_name}!")
34
+ self.resource = send("current_#{resource_name}")
35
+ end
36
+ end
@@ -1,17 +1,17 @@
1
- <h2>Renew your password</h2>
2
- <p>Your current password has expired. Please create a new password.</p>
3
-
4
- <%= form_for(resource, :as => resource_name, :url => [resource_name, :password_expired], :html => { :method => :put }) do |f| %>
5
- <%= devise_error_messages! %>
6
-
7
- <p><%= f.label :current_password, "Current password" %><br />
8
- <%= f.password_field :current_password %></p>
9
-
10
- <p><%= f.label :password, "New password" %><br />
11
- <%= f.password_field :password %></p>
12
-
13
- <p><%= f.label :password_confirmation, "Confirm new password" %><br />
14
- <%= f.password_field :password_confirmation %></p>
15
-
16
- <p><%= f.submit "Change my password" %></p>
17
- <% end %>
1
+ <h2>Renew your password</h2>
2
+ <p>Your current password has expired. Please create a new password.</p>
3
+
4
+ <%= form_for(resource, :as => resource_name, :url => [resource_name, :password_expired], :html => { :method => :put }) do |f| %>
5
+ <%= devise_error_messages! %>
6
+
7
+ <p><%= f.label :current_password, "Current password" %><br />
8
+ <%= f.password_field :current_password %></p>
9
+
10
+ <p><%= f.label :password, "New password" %><br />
11
+ <%= f.password_field :password %></p>
12
+
13
+ <p><%= f.label :password_confirmation, "Confirm new password" %><br />
14
+ <%= f.password_field :password_confirmation %></p>
15
+
16
+ <p><%= f.submit "Change my password" %></p>
17
+ <% end %>
@@ -1,9 +1,9 @@
1
- en:
2
- errors:
3
- messages:
4
- equal_to_current_password: "must be different to the current password!"
5
- password_format: "must contain at least 1 uppercase letter, 1 lowercase letter, and a number."
6
- devise:
7
- password_expired:
8
- updated: "Your new password is saved."
9
- change_required: "Your password is expired. Please renew your password!"
1
+ en:
2
+ errors:
3
+ messages:
4
+ equal_to_current_password: "must be different to the current password!"
5
+ password_format: "must contain at least 1 uppercase letter, 1 lowercase letter, and a number."
6
+ devise:
7
+ password_expired:
8
+ updated: "Your new password is saved."
9
+ change_required: "Your password is expired. Please renew your password!"
@@ -1,26 +1,26 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "devise_password_expirable/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "devise_password_expirable"
7
- s.version = DevisePasswordExpirable::VERSION.dup
8
- s.authors = ["Jenni Kissinger"]
9
- s.email = ["jkissinger@carekinesis.com"]
10
- s.homepage = "https://github.com/jenjaina/devise_password_expirable"
11
- s.licenses = ["MIT"]
12
- s.summary = %q{Expire passwords plugin for devise}
13
- s.description = "A plugin to devise that will expire user passwords after a set amount of time and prompt them to update their password."
14
-
15
- # s.rubyforge_project = "devise_password_expirable"
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.require_paths = ["lib"]
21
-
22
- s.add_runtime_dependency 'rails', '>= 3.0.20'
23
- s.add_runtime_dependency 'devise', '>= 1.1.3'
24
-
25
- s.add_development_dependency 'bundler'
26
- end
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "devise_password_expirable/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "devise_password_expirable"
7
+ s.version = DevisePasswordExpirable::VERSION.dup
8
+ s.authors = ["Jenni Kissinger"]
9
+ s.email = ["jkissinger@carekinesis.com"]
10
+ s.homepage = "https://github.com/jenjaina/devise_password_expirable"
11
+ s.licenses = ["MIT"]
12
+ s.summary = %q{Expire passwords plugin for devise}
13
+ s.description = "A plugin to devise that will expire user passwords after a set amount of time and prompt them to update their password."
14
+
15
+ # s.rubyforge_project = "devise_password_expirable"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_runtime_dependency 'rails', '>= 3.0.20'
23
+ s.add_runtime_dependency 'devise', '>= 2.0.0.rc'
24
+
25
+ s.add_development_dependency 'bundler'
26
+ end
@@ -1,32 +1,32 @@
1
- require 'devise_password_expirable/version'
2
- require 'active_record/connection_adapters/abstract/schema_definitions'
3
- require 'active_support/core_ext/integer'
4
- require 'active_support/ordered_hash'
5
- require 'active_support/concern'
6
- require 'devise'
7
-
8
- module Devise # :nodoc:
9
-
10
- # Should the password expire (e.g 3.months)
11
- mattr_accessor :expire_password_after
12
- @@expire_password_after = 3.months
13
-
14
- end
15
-
16
- # an security extension for devise
17
- module DevisePasswordExpirable
18
- autoload :Schema, 'devise_password_expirable/schema'
19
-
20
- module Controllers
21
- autoload :Helpers, 'devise_password_expirable/controllers/helpers'
22
- end
23
- end
24
-
25
- # modules
26
- Devise.add_module :password_expirable, :controller => :password_expirable, :model => 'devise_password_expirable/models/password_expirable', :route => :password_expired
27
-
28
- # requires
29
- require 'devise_password_expirable/routes'
30
- require 'devise_password_expirable/rails'
31
- require 'devise_password_expirable/orm/active_record'
1
+ require 'devise_password_expirable/version'
2
+ require 'active_record/connection_adapters/abstract/schema_definitions'
3
+ require 'active_support/core_ext/integer'
4
+ require 'active_support/ordered_hash'
5
+ require 'active_support/concern'
6
+ require 'devise'
7
+
8
+ module Devise # :nodoc:
9
+
10
+ # Should the password expire (e.g 3.months)
11
+ mattr_accessor :expire_password_after
12
+ @@expire_password_after = 3.months
13
+
14
+ end
15
+
16
+ # an security extension for devise
17
+ module DevisePasswordExpirable
18
+ autoload :Schema, 'devise_password_expirable/schema'
19
+
20
+ module Controllers
21
+ autoload :Helpers, 'devise_password_expirable/controllers/helpers'
22
+ end
23
+ end
24
+
25
+ # modules
26
+ Devise.add_module :password_expirable, :controller => :password_expirable, :model => 'devise_password_expirable/models/password_expirable', :route => :password_expired
27
+
28
+ # requires
29
+ require 'devise_password_expirable/routes'
30
+ require 'devise_password_expirable/rails'
31
+ require 'devise_password_expirable/orm/active_record'
32
32
  require 'devise_password_expirable/models/database_authenticatable_patch'
@@ -1,50 +1,50 @@
1
- module DevisePasswordExpirable
2
- module Controllers # :nodoc:
3
- module Helpers # :nodoc:
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- before_filter :handle_password_change
8
- end
9
-
10
- # controller instance methods
11
- module InstanceMethods
12
- private
13
-
14
- # lookup if an password change needed
15
- def handle_password_change
16
- if not devise_controller? and not ignore_password_expire? and not request.format.nil? and request.format.html?
17
- Devise.mappings.keys.flatten.any? do |scope|
18
- if signed_in?(scope) and warden.session(scope)[:password_expired]
19
- session["#{scope}_return_to"] = request.path if request.get?
20
- redirect_for_password_change scope
21
- return
22
- end
23
- end
24
- end
25
- end
26
-
27
- # redirect for password update with alert message
28
- def redirect_for_password_change(scope)
29
- redirect_to change_password_required_path_for(scope), :alert => I18n.t('change_required', {:scope => 'devise.password_expired'})
30
- end
31
-
32
- # path for change password
33
- def change_password_required_path_for(resource_or_scope = nil)
34
- scope = Devise::Mapping.find_scope!(resource_or_scope)
35
- change_path = "#{scope}_password_expired_path"
36
- send(change_path)
37
- end
38
-
39
- protected
40
-
41
- # allow to overwrite for some special handlings
42
- def ignore_password_expire?
43
- false
44
- end
45
-
46
- end
47
- end
48
- end
49
-
50
- end
1
+ module DevisePasswordExpirable
2
+ module Controllers # :nodoc:
3
+ module Helpers # :nodoc:
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before_filter :handle_password_change
8
+ end
9
+
10
+ # controller instance methods
11
+ module InstanceMethods
12
+ private
13
+
14
+ # lookup if an password change needed
15
+ def handle_password_change
16
+ if not devise_controller? and not ignore_password_expire? and not request.format.nil? and request.format.html?
17
+ Devise.mappings.keys.flatten.any? do |scope|
18
+ if signed_in?(scope) and warden.session(scope)[:password_expired]
19
+ session["#{scope}_return_to"] = request.path if request.get?
20
+ redirect_for_password_change scope
21
+ return
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ # redirect for password update with alert message
28
+ def redirect_for_password_change(scope)
29
+ redirect_to change_password_required_path_for(scope), :alert => I18n.t('change_required', {:scope => 'devise.password_expired'})
30
+ end
31
+
32
+ # path for change password
33
+ def change_password_required_path_for(resource_or_scope = nil)
34
+ scope = Devise::Mapping.find_scope!(resource_or_scope)
35
+ change_path = "#{scope}_password_expired_path"
36
+ send(change_path)
37
+ end
38
+
39
+ protected
40
+
41
+ # allow to overwrite for some special handlings
42
+ def ignore_password_expire?
43
+ false
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+
50
+ end
@@ -1,5 +1,5 @@
1
- Warden::Manager.after_authentication do |record, warden, options|
2
- if record.respond_to?(:need_change_password?)
3
- warden.session(options[:scope])[:password_expired] = record.need_change_password?
4
- end
5
- end
1
+ Warden::Manager.after_authentication do |record, warden, options|
2
+ if record.respond_to?(:need_change_password?)
3
+ warden.session(options[:scope])[:password_expired] = record.need_change_password?
4
+ end
5
+ end
@@ -1,35 +1,35 @@
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
- if current_password.blank?
14
- self.errors.add(:current_password, :blank)
15
- elsif !valid_password?(current_password)
16
- self.errors.add(:current_password, :invalid)
17
- end
18
-
19
- if new_password.blank?
20
- self.errors.add(:password, :blank)
21
- end
22
- if new_password_confirmation.blank?
23
- self.errors.add(:password_confirmation, :blank)
24
- end
25
-
26
- self.attributes = params
27
- false
28
- end
29
-
30
- clean_up_passwords
31
- result
32
- end
33
- end
34
- end
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
+ if current_password.blank?
14
+ self.errors.add(:current_password, :blank)
15
+ elsif !valid_password?(current_password)
16
+ self.errors.add(:current_password, :invalid)
17
+ end
18
+
19
+ if new_password.blank?
20
+ self.errors.add(:password, :blank)
21
+ end
22
+ if new_password_confirmation.blank?
23
+ self.errors.add(:password_confirmation, :blank)
24
+ end
25
+
26
+ self.attributes = params
27
+ false
28
+ end
29
+
30
+ clean_up_passwords
31
+ result
32
+ end
33
+ end
34
+ end
35
35
  end
@@ -1,63 +1,63 @@
1
- require 'devise_password_expirable/hooks/password_expirable'
2
-
3
- module Devise # :nodoc:
4
- module Models # :nodoc:
5
-
6
- # PasswordExpirable takes care of change password after
7
- module PasswordExpirable
8
-
9
- def self.included(base) # :nodoc:
10
- base.extend ClassMethods
11
-
12
- base.class_eval do
13
- before_save :update_password_changed
14
- include InstanceMethods
15
- end
16
- end
17
-
18
- module InstanceMethods # :nodoc:
19
-
20
- # is an password change required?
21
- def need_change_password?
22
- if self.class.expire_password_after.is_a? Fixnum
23
- self.last_password_reset.nil? or self.last_password_reset < self.class.expire_password_after.ago
24
- else
25
- false
26
- end
27
- end
28
-
29
- # set a fake datetime so a password change is needed and save the record
30
- def need_change_password!
31
- if self.class.expire_password_after.is_a? Fixnum
32
- need_change_password
33
- self.save(:validate => false)
34
- end
35
- end
36
-
37
- # set a fake datetime so a password change is needed
38
- def need_change_password
39
- if self.class.expire_password_after.is_a? Fixnum
40
- self.last_password_reset = self.class.expire_password_after.ago
41
- end
42
-
43
- # is date not set it will set default to need set new password next login
44
- need_change_password if self.last_password_reset.nil?
45
-
46
- self.last_password_reset
47
- end
48
-
49
- private
50
-
51
- # is password changed then update password_changed_at
52
- def update_password_changed
53
- self.last_password_reset = Time.now if (self.new_record? or self.encrypted_password_changed?) and not self.last_password_reset_changed?
54
- end
55
- end
56
-
57
- module ClassMethods #:nodoc:
58
- ::Devise::Models.config(self, :expire_password_after)
59
- end
60
- end
61
- end
62
-
1
+ require 'devise_password_expirable/hooks/password_expirable'
2
+
3
+ module Devise # :nodoc:
4
+ module Models # :nodoc:
5
+
6
+ # PasswordExpirable takes care of change password after
7
+ module PasswordExpirable
8
+
9
+ def self.included(base) # :nodoc:
10
+ base.extend ClassMethods
11
+
12
+ base.class_eval do
13
+ before_save :update_password_changed
14
+ include InstanceMethods
15
+ end
16
+ end
17
+
18
+ module InstanceMethods # :nodoc:
19
+
20
+ # is an password change required?
21
+ def need_change_password?
22
+ if self.class.expire_password_after.is_a? Fixnum
23
+ self.last_password_reset.nil? or self.last_password_reset < self.class.expire_password_after.ago
24
+ else
25
+ false
26
+ end
27
+ end
28
+
29
+ # set a fake datetime so a password change is needed and save the record
30
+ def need_change_password!
31
+ if self.class.expire_password_after.is_a? Fixnum
32
+ need_change_password
33
+ self.save(:validate => false)
34
+ end
35
+ end
36
+
37
+ # set a fake datetime so a password change is needed
38
+ def need_change_password
39
+ if self.class.expire_password_after.is_a? Fixnum
40
+ self.last_password_reset = self.class.expire_password_after.ago
41
+ end
42
+
43
+ # is date not set it will set default to need set new password next login
44
+ need_change_password if self.last_password_reset.nil?
45
+
46
+ self.last_password_reset
47
+ end
48
+
49
+ private
50
+
51
+ # is password changed then update password_changed_at
52
+ def update_password_changed
53
+ self.last_password_reset = Time.now if (self.new_record? or self.encrypted_password_changed?) and not self.last_password_reset_changed?
54
+ end
55
+ end
56
+
57
+ module ClassMethods #:nodoc:
58
+ ::Devise::Models.config(self, :expire_password_after)
59
+ end
60
+ end
61
+ end
62
+
63
63
  end
@@ -1,20 +1,20 @@
1
- module DevisePasswordExpirable
2
- module Orm
3
- # This module contains some helpers and handle schema (migrations):
4
- #
5
- # create_table :accounts do |t|
6
- # t.password_expirable
7
- # end
8
- #
9
- module ActiveRecord
10
- module Schema
11
- include DevisePasswordExpirable::Schema
12
-
13
-
14
- end
15
- end
16
- end
17
- end
18
-
19
- ActiveRecord::ConnectionAdapters::Table.send :include, DevisePasswordExpirable::Orm::ActiveRecord::Schema
1
+ module DevisePasswordExpirable
2
+ module Orm
3
+ # This module contains some helpers and handle schema (migrations):
4
+ #
5
+ # create_table :accounts do |t|
6
+ # t.password_expirable
7
+ # end
8
+ #
9
+ module ActiveRecord
10
+ module Schema
11
+ include DevisePasswordExpirable::Schema
12
+
13
+
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ ActiveRecord::ConnectionAdapters::Table.send :include, DevisePasswordExpirable::Orm::ActiveRecord::Schema
20
20
  ActiveRecord::ConnectionAdapters::TableDefinition.send :include, DevisePasswordExpirable::Orm::ActiveRecord::Schema
@@ -1,7 +1,7 @@
1
- module DevisePasswordExpirable
2
- class Engine < ::Rails::Engine # :nodoc:
3
- ActiveSupport.on_load(:action_controller) do
4
- include DevisePasswordExpirable::Controllers::Helpers
5
- end
6
- end
7
- end
1
+ module DevisePasswordExpirable
2
+ class Engine < ::Rails::Engine # :nodoc:
3
+ ActiveSupport.on_load(:action_controller) do
4
+ include DevisePasswordExpirable::Controllers::Helpers
5
+ end
6
+ end
7
+ end
@@ -1,13 +1,13 @@
1
- module ActionDispatch::Routing # :nodoc:
2
- class Mapper # :nodoc:
3
-
4
- protected
5
-
6
- # route for handle expired passwords
7
- def devise_password_expired(mapping, controllers)
8
- resource :password_expired, :only => [:show, :update], :path => mapping.path_names[:password_expired], :controller => controllers[:password_expired]
9
- end
10
-
11
- end
12
- end
13
-
1
+ module ActionDispatch::Routing # :nodoc:
2
+ class Mapper # :nodoc:
3
+
4
+ protected
5
+
6
+ # route for handle expired passwords
7
+ def devise_password_expired(mapping, controllers)
8
+ resource :password_expired, :only => [:show, :update], :path => mapping.path_names[:password_expired], :controller => controllers[:password_expired]
9
+ end
10
+
11
+ end
12
+ end
13
+
@@ -1,24 +1,24 @@
1
- module DevisePasswordExpirable
2
- # add schema helper for migrations
3
- module Schema
4
- # Add last_password_reset columns in the resource's database table.
5
- #
6
- # Examples
7
- #
8
- # # For a new resource migration:
9
- # create_table :the_resources do |t|
10
- # t.password_expirable
11
- # ...
12
- # end
13
- #
14
- # # or if the resource's table already exists, define a migration and put this in:
15
- # change_table :the_resources do |t|
16
- # t.datetime :last_password_reset
17
- # end
18
- #
19
- def password_expirable
20
- apply_devise_schema :last_password_reset, DateTime
21
- end
22
-
23
- end
24
- end
1
+ module DevisePasswordExpirable
2
+ # add schema helper for migrations
3
+ module Schema
4
+ # Add last_password_reset columns in the resource's database table.
5
+ #
6
+ # Examples
7
+ #
8
+ # # For a new resource migration:
9
+ # create_table :the_resources do |t|
10
+ # t.password_expirable
11
+ # ...
12
+ # end
13
+ #
14
+ # # or if the resource's table already exists, define a migration and put this in:
15
+ # change_table :the_resources do |t|
16
+ # t.datetime :last_password_reset
17
+ # end
18
+ #
19
+ def password_expirable
20
+ apply_devise_schema :last_password_reset, DateTime
21
+ end
22
+
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
- module DevisePasswordExpirable
2
- VERSION = "0.0.6"
1
+ module DevisePasswordExpirable
2
+ VERSION = "2.0.0"
3
3
  end
@@ -1,36 +1,36 @@
1
- module DevisePasswordExpirable
2
- module Generators # :nodoc:
3
- # Install Generator
4
- class InstallGenerator < Rails::Generators::Base
5
- source_root File.expand_path("../../templates", __FILE__)
6
-
7
- desc "Install the devise password expirable extension"
8
-
9
- def add_configs
10
- devise_initializer_path = "config/initializers/devise.rb"
11
- if File.exist?(devise_initializer_path)
12
- old_content = File.read(devise_initializer_path)
13
-
14
- if old_content.match(Regexp.new(/^\s# ==> Password Expirable Extension\n/))
15
- false
16
- else
17
- inject_into_file(devise_initializer_path, :before => " # ==> Configuration for :confirmable\n") do
18
- <<-CONTENT
19
- # ==> Password Expirable Extension
20
- # Configure expire passwords extension for devise
21
-
22
- # Should the password expire (e.g 3.months)
23
- # config.expire_password_after = false
24
-
25
- CONTENT
26
- end
27
- end
28
- end
29
- end
30
-
31
- def copy_locale
32
- copy_file "../../../config/locales/en.yml", "config/locales/devise.password_expirable.en.yml"
33
- end
34
- end
35
- end
1
+ module DevisePasswordExpirable
2
+ module Generators # :nodoc:
3
+ # Install Generator
4
+ class InstallGenerator < Rails::Generators::Base
5
+ source_root File.expand_path("../../templates", __FILE__)
6
+
7
+ desc "Install the devise password expirable extension"
8
+
9
+ def add_configs
10
+ devise_initializer_path = "config/initializers/devise.rb"
11
+ if File.exist?(devise_initializer_path)
12
+ old_content = File.read(devise_initializer_path)
13
+
14
+ if old_content.match(Regexp.new(/^\s# ==> Password Expirable Extension\n/))
15
+ false
16
+ else
17
+ inject_into_file(devise_initializer_path, :before => " # ==> Configuration for :confirmable\n") do
18
+ <<-CONTENT
19
+ # ==> Password Expirable Extension
20
+ # Configure expire passwords extension for devise
21
+
22
+ # Should the password expire (e.g 3.months)
23
+ # config.expire_password_after = false
24
+
25
+ CONTENT
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ def copy_locale
32
+ copy_file "../../../config/locales/en.yml", "config/locales/devise.password_expirable.en.yml"
33
+ end
34
+ end
35
+ end
36
36
  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.6
4
+ version: 2.0.0
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-11-12 00:00:00 Z
12
+ date: 2016-05-16 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -28,7 +28,7 @@ dependencies:
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: 1.1.3
31
+ version: 2.0.0.rc
32
32
  type: :runtime
33
33
  version_requirements: *id002
34
34
  - !ruby/object:Gem::Dependency
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements: []
92
92
 
93
93
  rubyforge_project:
94
- rubygems_version: 2.4.1
94
+ rubygems_version: 2.0.15
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Expire passwords plugin for devise