double_auth_engine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/.gitignore +7 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +9 -0
  4. data/Gemfile.lock +136 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +59 -0
  7. data/Rakefile +25 -0
  8. data/app/controllers/password_resets_controller.rb +3 -0
  9. data/app/controllers/user_sessions_controller.rb +3 -0
  10. data/app/controllers/users_controller.rb +3 -0
  11. data/app/mailers/notifier.rb +8 -0
  12. data/app/models/assignment.rb +3 -0
  13. data/app/models/role.rb +3 -0
  14. data/app/models/user.rb +3 -0
  15. data/app/models/user_session.rb +3 -0
  16. data/app/views/notifier/password_reset_instructions.text.erb +8 -0
  17. data/app/views/password_resets/edit.html.erb +5 -0
  18. data/app/views/password_resets/new.html.erb +5 -0
  19. data/app/views/user_sessions/new.html.erb +17 -0
  20. data/app/views/users/edit.html.erb +0 -0
  21. data/app/views/users/index.html.erb +0 -0
  22. data/app/views/users/new.html.erb +20 -0
  23. data/app/views/users/show.html.erb +2 -0
  24. data/config/routes.rb +11 -0
  25. data/double_auth_engine.gemspec +26 -0
  26. data/lib/double_auth_engine/controllers/application_controller_mixin.rb +42 -0
  27. data/lib/double_auth_engine/controllers/password_resets_controller_mixin.rb +49 -0
  28. data/lib/double_auth_engine/controllers/user_sessions_controller_mixin.rb +34 -0
  29. data/lib/double_auth_engine/controllers/users_controller_mixin.rb +63 -0
  30. data/lib/double_auth_engine/generators/double_auth_engine/install_generator.rb +48 -0
  31. data/lib/double_auth_engine/generators/double_auth_engine/templates/assignment_migration.rb +13 -0
  32. data/lib/double_auth_engine/generators/double_auth_engine/templates/authorization_rules.rb +19 -0
  33. data/lib/double_auth_engine/generators/double_auth_engine/templates/role_migration.rb +12 -0
  34. data/lib/double_auth_engine/generators/double_auth_engine/templates/setup_mail_initializer.rb +7 -0
  35. data/lib/double_auth_engine/generators/double_auth_engine/templates/user_migration.rb +28 -0
  36. data/lib/double_auth_engine/models/assignment_mixin.rb +10 -0
  37. data/lib/double_auth_engine/models/role_mixin.rb +10 -0
  38. data/lib/double_auth_engine/models/user_mixin.rb +38 -0
  39. data/lib/double_auth_engine/models/user_session_mixin.rb +15 -0
  40. data/lib/double_auth_engine/tasks/migrate_seed.rake +9 -0
  41. data/lib/double_auth_engine/version.rb +3 -0
  42. data/lib/double_auth_engine.rb +15 -0
  43. data/lib/engine.rb +23 -0
  44. data/spec/double_auth_engine_spec.rb +7 -0
  45. data/spec/dummy/Rakefile +7 -0
  46. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  47. data/spec/dummy/app/controllers/dashboard_controller.rb +3 -0
  48. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  49. data/spec/dummy/app/views/dashboard/index.html.erb +0 -0
  50. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  51. data/spec/dummy/config/application.rb +48 -0
  52. data/spec/dummy/config/authorization_rules.rb +20 -0
  53. data/spec/dummy/config/boot.rb +10 -0
  54. data/spec/dummy/config/database.yml +22 -0
  55. data/spec/dummy/config/environment.rb +5 -0
  56. data/spec/dummy/config/environments/development.rb +29 -0
  57. data/spec/dummy/config/environments/production.rb +52 -0
  58. data/spec/dummy/config/environments/test.rb +35 -0
  59. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/spec/dummy/config/initializers/inflections.rb +10 -0
  61. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  62. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  63. data/spec/dummy/config/initializers/session_store.rb +8 -0
  64. data/spec/dummy/config/initializers/setup_mail.rb +9 -0
  65. data/spec/dummy/config/locales/en.yml +5 -0
  66. data/spec/dummy/config/routes.rb +3 -0
  67. data/spec/dummy/config.ru +4 -0
  68. data/spec/dummy/db/migrate/20110408030355_create_users.rb +28 -0
  69. data/spec/dummy/db/migrate/20110408030356_create_roles.rb +12 -0
  70. data/spec/dummy/db/migrate/20110408030357_create_assignments.rb +13 -0
  71. data/spec/dummy/db/schema.rb +51 -0
  72. data/spec/dummy/db/seeds.rb +3 -0
  73. data/spec/dummy/lib/development_mail_interceptor.rb +6 -0
  74. data/spec/dummy/public/404.html +26 -0
  75. data/spec/dummy/public/422.html +26 -0
  76. data/spec/dummy/public/500.html +26 -0
  77. data/spec/dummy/public/favicon.ico +0 -0
  78. data/spec/dummy/public/javascripts/application.js +2 -0
  79. data/spec/dummy/public/javascripts/controls.js +965 -0
  80. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  81. data/spec/dummy/public/javascripts/effects.js +1123 -0
  82. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  83. data/spec/dummy/public/javascripts/rails.js +175 -0
  84. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  85. data/spec/dummy/script/rails +6 -0
  86. data/spec/dummy/spec/authorizations/user_spec.rb +104 -0
  87. data/spec/dummy/spec/controllers/user_sessions_controller_spec.rb +48 -0
  88. data/spec/dummy/spec/controllers/users_controller_spec.rb +125 -0
  89. data/spec/dummy/spec/models/user_spec.rb +65 -0
  90. data/spec/integration/navigation_spec.rb +9 -0
  91. data/spec/spec_helper.rb +42 -0
  92. data/spec/support/user_authentication.rb +14 -0
  93. data/spec/support/user_authorization.rb +17 -0
  94. metadata +218 -0
@@ -0,0 +1,51 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended to check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(:version => 20110408030357) do
14
+
15
+ create_table "assignments", :force => true do |t|
16
+ t.integer "user_id"
17
+ t.integer "role_id"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ end
21
+
22
+ create_table "roles", :force => true do |t|
23
+ t.string "name"
24
+ t.datetime "created_at"
25
+ t.datetime "updated_at"
26
+ end
27
+
28
+ create_table "users", :force => true do |t|
29
+ t.string "email", :null => false
30
+ t.string "name", :limit => 100, :null => false
31
+ t.string "location", :limit => 150
32
+ t.string "crypted_password", :null => false
33
+ t.string "password_salt", :null => false
34
+ t.string "persistence_token", :null => false
35
+ t.string "single_access_token", :null => false
36
+ t.string "perishable_token", :null => false
37
+ t.integer "login_count", :default => 0, :null => false
38
+ t.integer "failed_login_count", :default => 0, :null => false
39
+ t.datetime "last_request_at"
40
+ t.datetime "current_login_at"
41
+ t.datetime "last_login_at"
42
+ t.string "current_login_ip"
43
+ t.string "last_login_ip"
44
+ t.datetime "created_at"
45
+ t.datetime "updated_at"
46
+ end
47
+
48
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
49
+ add_index "users", ["perishable_token"], :name => "index_users_on_perishable_token"
50
+
51
+ end
@@ -0,0 +1,3 @@
1
+ if Role.all.empty?
2
+ Role.create(:name => 'admin')
3
+ end
@@ -0,0 +1,6 @@
1
+ class DevelopmentMailInterceptor
2
+ def self.delivering_email(message)
3
+ message.subject = "#{message.to} #{message.subject}"
4
+ message.to = "changeme@dummy.com"
5
+ end
6
+ end
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,2 @@
1
+ // Place your application-specific JavaScript functions and classes here
2
+ // This file is automatically included by javascript_include_tag :defaults