passconf 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +87 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/passconf/application.js +1 -0
- data/app/assets/javascripts/passconf/index.js +1 -0
- data/app/assets/javascripts/passconf/password_template.js +15 -0
- data/app/assets/stylesheets/passconf/application.css +15 -0
- data/app/assets/stylesheets/passconf/index.css +13 -0
- data/app/controllers/passconf/application_controller.rb +4 -0
- data/app/controllers/passconf/password_confirmations_controller.rb +28 -0
- data/app/helpers/passconf/application_helper.rb +26 -0
- data/app/helpers/passconf/password_confirmations_helper.rb +4 -0
- data/app/views/layouts/passconf/_password_confirmation.html.erb +34 -0
- data/app/views/layouts/passconf/_phr_section.html.erb +2 -0
- data/app/views/layouts/passconf/application.html.erb +14 -0
- data/app/views/passconf/password_confirmations/password_authentication.js.erb +41 -0
- data/app/views/passconf/password_confirmations/password_dialog.js.erb +12 -0
- data/config/routes.rb +9 -0
- data/lib/generators/passconf/assets_generator.rb +11 -0
- data/lib/generators/passconf/controllers_generator.rb +10 -0
- data/lib/generators/passconf/migrations_generator.rb +18 -0
- data/lib/generators/passconf/views_generator.rb +13 -0
- data/lib/generators/templates/add_password_status_columns.rb +9 -0
- data/lib/passconf.rb +4 -0
- data/lib/passconf/engine.rb +11 -0
- data/lib/passconf/version.rb +3 -0
- data/lib/tasks/passconf_tasks.rake +4 -0
- metadata +145 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
MjExYTA0YzJkYjBiNGU3NTYyMTJkZmY1ZTEyMDg0NzVmYmEzNTBlNQ==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
ODMzYTNlMDVlNDIyOWM1ODIxNWE1NjM3ZTRkOWIwZmFkZmI3ZWJjYQ==
|
|
7
|
+
SHA512:
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
MjY0YWYzNzBlNmRhMzQxODVmYTFmMTRkNWFmNzZjMDdjMzlhZGY5NWRkZjQw
|
|
10
|
+
YzQ2ZDljMDRkZWViODNkMWM0ZTEyZDQyMTkxMWMxMmY2ZmRiODgyMTE1MDhl
|
|
11
|
+
NzJjMjViZjVjOTc3MjI3ODc3NTYwYzIwZTVjMWQ3Yzc4MjI5ZGM=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
MTQ3ZDZhMzQyODZhZTNjOTllOTM2YjU4NjEyMTFiMWQ2OTNlYjc4NzFjMGQ4
|
|
14
|
+
MWJiMWU2MTIwMjg1OWIxZWRiODE3MzFmZjc1Y2I1YjA2YTFkYzBiNmY1Y2Zk
|
|
15
|
+
NmYxOWJlMmYxZWQzNjNlZDE0ZWJjM2YyYTY5M2E3MjY2ODRhZDA=
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2014 Tanmay Bagchi
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Passconf
|
|
2
|
+
|
|
3
|
+
This is a nice and simple full Rails Engine where use can authorize Password before continue to a Rails Controller action.
|
|
4
|
+
|
|
5
|
+
Basically In high secure web site like Banking or HealthCare domain before get enter into Rails Controller action
|
|
6
|
+
|
|
7
|
+
It will ask for password before continue.
|
|
8
|
+
|
|
9
|
+
The main function of that gem is in a link you need to specify a css class and controller name. When user will click the
|
|
10
|
+
|
|
11
|
+
link a Password Confirmation pop up appear and after validating your password only it will give you the access to that
|
|
12
|
+
|
|
13
|
+
respective controller action.
|
|
14
|
+
|
|
15
|
+
In Usage, you can find proper example.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Add this line to your application's Gemfile:
|
|
20
|
+
|
|
21
|
+
gem 'passconf'
|
|
22
|
+
|
|
23
|
+
And then execute:
|
|
24
|
+
|
|
25
|
+
$ bundle
|
|
26
|
+
|
|
27
|
+
Or install it yourself as:
|
|
28
|
+
|
|
29
|
+
$ gem install passconf
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
After Gem install
|
|
34
|
+
|
|
35
|
+
rails g passconf:migrations [list of controllers]
|
|
36
|
+
Example: rails g passconf:migrations blogs file_uploads
|
|
37
|
+
|
|
38
|
+
blogs and file_uploads is your controller name.
|
|
39
|
+
|
|
40
|
+
Then You need to run:
|
|
41
|
+
|
|
42
|
+
rake db:migrate
|
|
43
|
+
|
|
44
|
+
You can generate the following files:-
|
|
45
|
+
|
|
46
|
+
rails g passconf:assets
|
|
47
|
+
rails g passconf:controllers
|
|
48
|
+
rails g passconf:views
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Go to your view file and add the link with css class and data-controller attributes:-
|
|
52
|
+
|
|
53
|
+
<%= link_to 'New Blog', new_blog_path, class: 'passwordconfirmationDialog', data: {:link_name=>"blogs", :controller_name => 'blogs' } %>
|
|
54
|
+
Main part add css class as `passwordconfirmationDialog` and `:controller_name` => Controller Name which that link lead to.
|
|
55
|
+
|
|
56
|
+
Important thing you need to add `<%= javascript_include_tag 'passconf' %>` at the end of the View File.
|
|
57
|
+
|
|
58
|
+
Otherwise your javascript will not load and Pop-up will not come.
|
|
59
|
+
|
|
60
|
+
In `routes.rb` file
|
|
61
|
+
|
|
62
|
+
mount Passconf::Engine => "/passconf", :as => "passconf_engine"
|
|
63
|
+
|
|
64
|
+
In `application_controller.rb` file
|
|
65
|
+
|
|
66
|
+
before_filter :reset_password_status
|
|
67
|
+
|
|
68
|
+
In your controller file which need to Password Authenticated
|
|
69
|
+
|
|
70
|
+
Like in that example blogs_controller.rb and file_uploads_controller.rb file :-
|
|
71
|
+
|
|
72
|
+
before_filter :check_password_status
|
|
73
|
+
skip_before_filter :reset_password_status
|
|
74
|
+
|
|
75
|
+
All done.
|
|
76
|
+
|
|
77
|
+
Please let me know if you find any bugs in it.
|
|
78
|
+
|
|
79
|
+
In Future release I will work on Filtering, routes and callback. Best of luck.
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
1. Fork it
|
|
84
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
85
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
86
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
87
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
begin
|
|
8
|
+
require 'rdoc/task'
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require 'rdoc/rdoc'
|
|
11
|
+
require 'rake/rdoctask'
|
|
12
|
+
RDoc::Task = Rake::RDocTask
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
17
|
+
rdoc.title = 'Passconf'
|
|
18
|
+
rdoc.options << '--line-numbers'
|
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
24
|
+
load 'rails/tasks/engine.rake'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Bundler::GemHelper.install_tasks
|
|
29
|
+
|
|
30
|
+
require 'rake/testtask'
|
|
31
|
+
|
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
|
33
|
+
t.libs << 'lib'
|
|
34
|
+
t.libs << 'test'
|
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
|
36
|
+
t.verbose = false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
task :default => :test
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//= require ./password_template
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
$('.passwordconfirmationDialog').on('click',function(e){
|
|
2
|
+
e.stopPropagation();
|
|
3
|
+
e.preventDefault();
|
|
4
|
+
var link_name = $(this).data('link-name');
|
|
5
|
+
var controller_name = $(this).data('controller-name');
|
|
6
|
+
$(this).addClass('uniqueClassForPasswordTemplate');
|
|
7
|
+
$('.password_modal').remove();
|
|
8
|
+
$('<div class="password_modal modalDialog"/>').appendTo('body');
|
|
9
|
+
$.ajax({
|
|
10
|
+
url: "passconf/password_confirmations/password_dialog",
|
|
11
|
+
type: "GET",
|
|
12
|
+
dataType: "script",
|
|
13
|
+
data: {link_name: link_name, controller_name: controller_name}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
|
|
12
|
+
*= require_self
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*/
|
|
15
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require_dependency "passconf/application_controller"
|
|
2
|
+
|
|
3
|
+
module Passconf
|
|
4
|
+
class PasswordConfirmationsController < ApplicationController
|
|
5
|
+
skip_before_filter :reset_password_status
|
|
6
|
+
|
|
7
|
+
def password_dialog
|
|
8
|
+
@current_controller_name = params[:controller_name]
|
|
9
|
+
respond_to do |format|
|
|
10
|
+
format.js
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def password_authentication
|
|
15
|
+
decrypt_password = params[:user][:password]
|
|
16
|
+
@status = current_user.valid_password?(decrypt_password)
|
|
17
|
+
@link_name = params[:user][:link_name]
|
|
18
|
+
@current_controller_name = params[:user][:controller_name]
|
|
19
|
+
field_name = "password_status_#{@current_controller_name}"
|
|
20
|
+
if @status && !field_name.blank?
|
|
21
|
+
current_user.update_attribute(field_name, true) if current_user.respond_to?(field_name)
|
|
22
|
+
end
|
|
23
|
+
respond_to do |format|
|
|
24
|
+
format.js
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Passconf
|
|
2
|
+
module ApplicationHelper
|
|
3
|
+
def check_password_status
|
|
4
|
+
if current_user
|
|
5
|
+
@req_controller = params[:controller]
|
|
6
|
+
@password_status = current_user.send("password_status_#{@req_controller }") if current_user.respond_to?("password_status_#{@req_controller }")
|
|
7
|
+
unless @password_status
|
|
8
|
+
|
|
9
|
+
redirect_to root_path, notice: "You did not authorize password authentication."
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def reset_password_status
|
|
15
|
+
if current_user
|
|
16
|
+
req_controller = params[:controller]
|
|
17
|
+
user_columns = User.columns.collect(&:name).select{|i| i =~ /password_status_/}
|
|
18
|
+
user_columns.each do |element|
|
|
19
|
+
unless element == req_controller && current_user.send(element)
|
|
20
|
+
current_user.update_attribute(element, false)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<div class="modal-body">
|
|
2
|
+
<div class="bootbox-body">
|
|
3
|
+
<%= form_for(User.new, url: 'passconf/password_confirmations/password_authentication', :html => {:method => :post, :class => "new_user_registration password_form form-inline"}, remote: true) do |f| %>
|
|
4
|
+
<span class="block input-icon input-icon-right">
|
|
5
|
+
<%= f.password_field :password, :class => 'password_register', :placeholder => "Password", autocomplete: "off", :id => "password_auth_dialog" do %><i class="icon-lock"></i><% end %>
|
|
6
|
+
<input name="user[link_name]" type="hidden" value='<%= @link_name %>'>
|
|
7
|
+
<input name="user[controller_name]" type="hidden" value='<%= @current_controller_name %>'>
|
|
8
|
+
<button type="submit" name="commit" class="btn btn-small btn-info no-radius btn_position pull-right">
|
|
9
|
+
<i class="icon-unlock"></i>
|
|
10
|
+
Submit
|
|
11
|
+
</button>
|
|
12
|
+
<%#= f.submit "Submit", class: "btn btn-sm btn-success btn_position pull-right" do %>
|
|
13
|
+
<%#end %>
|
|
14
|
+
</span>
|
|
15
|
+
|
|
16
|
+
<% end %>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<script>
|
|
20
|
+
/*$("#password_auth_dialog").on("change", function(){
|
|
21
|
+
var my_password = $(this).val();
|
|
22
|
+
var encrypt_pass = $.base64.encode(my_password);
|
|
23
|
+
$(this).val(encrypt_pass);
|
|
24
|
+
});*/
|
|
25
|
+
</script>
|
|
26
|
+
<style>
|
|
27
|
+
.btn_position{
|
|
28
|
+
margin-top: 20px;
|
|
29
|
+
}
|
|
30
|
+
.password_register{
|
|
31
|
+
margin-top: 20px;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
34
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Passconf</title>
|
|
5
|
+
<%= stylesheet_link_tag "passconf/application", :media => "all" %>
|
|
6
|
+
<%= javascript_include_tag "passconf/application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var status = "<%= @status %>";
|
|
2
|
+
if(status == "true"){
|
|
3
|
+
var href = $('.uniqueClassForPasswordTemplate').attr("href");
|
|
4
|
+
document.location.href = href;
|
|
5
|
+
$('.passwordconfirmationDialog').removeClass('uniqueClassForPasswordTemplate');
|
|
6
|
+
$(".ui-dialog-titlebar-close").click();
|
|
7
|
+
var is_consultation_session_controller = "<%= @current_controller_name && @current_controller_name == "consultation_session" %>";
|
|
8
|
+
if (is_consultation_session_controller == "true"){
|
|
9
|
+
$('#phr_section').replaceWith("<div id='phr_section'><%= escape_javascript(render(:partial => 'layouts/passconf/phr_section' )) %></div>");
|
|
10
|
+
$( "#phr_click_id" ).on('click', function(e) {
|
|
11
|
+
var dialog = $( "#phr_file_preview" ).removeClass('hide').dialog({
|
|
12
|
+
title: "View PHR",
|
|
13
|
+
height: 600,
|
|
14
|
+
width: 600,
|
|
15
|
+
modal: true,
|
|
16
|
+
opacity:0.3,
|
|
17
|
+
position: { my: "left top", at: "left bottom" },
|
|
18
|
+
resizable: false,
|
|
19
|
+
show: { effect: "blind", duration: 800 },
|
|
20
|
+
buttons: [
|
|
21
|
+
{
|
|
22
|
+
text: "OK",
|
|
23
|
+
click: function() {
|
|
24
|
+
$( this ).dialog( "close" );
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
$( "#phr_click_id").click();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else{
|
|
34
|
+
$('.password_modal').empty();
|
|
35
|
+
html = '<div class="alert alert-danger" >Invalid password.</div>';
|
|
36
|
+
|
|
37
|
+
$('.password_modal').append(html);
|
|
38
|
+
$('.password_modal').append("<%= escape_javascript(render(:partial => 'layouts/passconf/password_confirmation' )) %>");
|
|
39
|
+
$('.password_modal').css('overflow-y', 'hidden');
|
|
40
|
+
}
|
|
41
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
$('.password_modal').remove();
|
|
2
|
+
$('<div class="password_modal"/>').appendTo('body');
|
|
3
|
+
$(".password_modal").empty();
|
|
4
|
+
$('.password_modal').append("<%= escape_javascript(render(:partial => 'layouts/passconf/password_confirmation' )) %>");
|
|
5
|
+
$(".password_modal").dialog({modal: true,
|
|
6
|
+
title: "Please Authenticate",
|
|
7
|
+
width: 375,
|
|
8
|
+
height: 200,
|
|
9
|
+
resizable: false,
|
|
10
|
+
position: ['top', 'center'],
|
|
11
|
+
autoResize: true});
|
|
12
|
+
$('.btn_position').css('margin-top', '20px');
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module Passconf
|
|
4
|
+
class AssetsGenerator < Rails::Generators::Base
|
|
5
|
+
source_root File.expand_path('../../../..', __FILE__)
|
|
6
|
+
def copy_files
|
|
7
|
+
copy_file "app/assets/javascripts/passconf/password_template.js", "app/assets/javascripts/passconf/password_template.js"
|
|
8
|
+
copy_file "app/assets/stylesheets/passconf/index.css", "app/assets/stylesheets/passconf/index.css"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module Passconf
|
|
4
|
+
class ControllersGenerator < Rails::Generators::Base
|
|
5
|
+
source_root File.expand_path('../../../..', __FILE__)
|
|
6
|
+
def copy_files
|
|
7
|
+
copy_file "app/controllers/passconf/password_confirmations_controller.rb", "app/controllers/passconf/password_confirmations_controller.rb"
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'rails/generators/migration'
|
|
3
|
+
module Passconf
|
|
4
|
+
class MigrationsGenerator < Rails::Generators::Base
|
|
5
|
+
argument :actions, :type => :hash, :default => {}, :banner => "action action"
|
|
6
|
+
argument :column_names, :type => :array, :default => [], :banner => "action action"
|
|
7
|
+
include Rails::Generators::Migration
|
|
8
|
+
source_root File.expand_path('../../templates', __FILE__)
|
|
9
|
+
|
|
10
|
+
def self.next_migration_number(path)
|
|
11
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create_model_file
|
|
15
|
+
migration_template "add_password_status_columns.rb", "db/migrate/add_password_status_columns.rb"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module Passconf
|
|
4
|
+
class ViewsGenerator < Rails::Generators::Base
|
|
5
|
+
source_root File.expand_path('../../../..', __FILE__)
|
|
6
|
+
def copy_files
|
|
7
|
+
copy_file "app/views/passconf/password_confirmations/password_authentication.js.erb", "app/views/passconf/password_confirmations/password_authentication.js.erb"
|
|
8
|
+
copy_file "app/views/passconf/password_confirmations/password_dialog.js.erb", "app/views/passconf/password_confirmations/password_dialog.js.erb"
|
|
9
|
+
copy_file "app/views/layouts/passconf/_password_confirmation.html.erb", "app/views/layouts/passconf/_password_confirmation.html.erb"
|
|
10
|
+
copy_file "app/views/layouts/passconf/_phr_section.html.erb", "app/views/layouts/passconf/_phr_section.html.erb"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class AddPasswordStatusColumns < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
<% table_name = actions["table_name"].blank? ? "users" : actions["table_name"] %><% column_names.each do |attribute| -%>
|
|
4
|
+
add_column :<%= table_name %>, :<%= "password_status_#{attribute}" %>, :boolean, :default => false
|
|
5
|
+
<% end %>
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
data/lib/passconf.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Passconf
|
|
2
|
+
class Engine < ::Rails::Engine
|
|
3
|
+
isolate_namespace Passconf
|
|
4
|
+
initializer "passconf.action_controller" do
|
|
5
|
+
ActiveSupport.on_load(:action_controller) do
|
|
6
|
+
puts "Extending #{self} with Passconf::Controller"
|
|
7
|
+
include Passconf::ApplicationHelper
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: passconf
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Tanmay Bagchi
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rails
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 3.2.12
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 3.2.12
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: jquery-rails
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ! '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ! '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: jquery-ui-rails
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ~>
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 4.1.0
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ~>
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 4.1.0
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: devise
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ! '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description: ! 'This is a nice and simple full Rails Engine where use can authorize
|
|
70
|
+
Password before continue to a Rails Controller action.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
Basically In high secure web site like Banking or HealthCare domain before get enter
|
|
74
|
+
into Rails Controller action
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
It will ask for password before continue.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
The main function of that gem is in a link you need to specify a css class and controller
|
|
81
|
+
name. When user will click the
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
link a Password Confirmation pop up appear and after validating your password only
|
|
85
|
+
it will give you the access to that
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
respective controller action.'
|
|
89
|
+
email:
|
|
90
|
+
- tbagchi85@gmail.com
|
|
91
|
+
executables: []
|
|
92
|
+
extensions: []
|
|
93
|
+
extra_rdoc_files: []
|
|
94
|
+
files:
|
|
95
|
+
- MIT-LICENSE
|
|
96
|
+
- README.rdoc
|
|
97
|
+
- Rakefile
|
|
98
|
+
- app/assets/javascripts/passconf/application.js
|
|
99
|
+
- app/assets/javascripts/passconf/index.js
|
|
100
|
+
- app/assets/javascripts/passconf/password_template.js
|
|
101
|
+
- app/assets/stylesheets/passconf/application.css
|
|
102
|
+
- app/assets/stylesheets/passconf/index.css
|
|
103
|
+
- app/controllers/passconf/application_controller.rb
|
|
104
|
+
- app/controllers/passconf/password_confirmations_controller.rb
|
|
105
|
+
- app/helpers/passconf/application_helper.rb
|
|
106
|
+
- app/helpers/passconf/password_confirmations_helper.rb
|
|
107
|
+
- app/views/layouts/passconf/_password_confirmation.html.erb
|
|
108
|
+
- app/views/layouts/passconf/_phr_section.html.erb
|
|
109
|
+
- app/views/layouts/passconf/application.html.erb
|
|
110
|
+
- app/views/passconf/password_confirmations/password_authentication.js.erb
|
|
111
|
+
- app/views/passconf/password_confirmations/password_dialog.js.erb
|
|
112
|
+
- config/routes.rb
|
|
113
|
+
- lib/generators/passconf/assets_generator.rb
|
|
114
|
+
- lib/generators/passconf/controllers_generator.rb
|
|
115
|
+
- lib/generators/passconf/migrations_generator.rb
|
|
116
|
+
- lib/generators/passconf/views_generator.rb
|
|
117
|
+
- lib/generators/templates/add_password_status_columns.rb
|
|
118
|
+
- lib/passconf.rb
|
|
119
|
+
- lib/passconf/engine.rb
|
|
120
|
+
- lib/passconf/version.rb
|
|
121
|
+
- lib/tasks/passconf_tasks.rake
|
|
122
|
+
homepage: ''
|
|
123
|
+
licenses: []
|
|
124
|
+
metadata: {}
|
|
125
|
+
post_install_message:
|
|
126
|
+
rdoc_options: []
|
|
127
|
+
require_paths:
|
|
128
|
+
- lib
|
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - ! '>='
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '0'
|
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ! '>='
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
requirements: []
|
|
140
|
+
rubyforge_project:
|
|
141
|
+
rubygems_version: 2.2.2
|
|
142
|
+
signing_key:
|
|
143
|
+
specification_version: 4
|
|
144
|
+
summary: ''
|
|
145
|
+
test_files: []
|