safeguard-devise 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +15 -0
  2. data/.vagrant/machines/default/virtualbox/action_provision +1 -0
  3. data/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  4. data/.vagrant/machines/default/virtualbox/id +1 -0
  5. data/Gemfile +25 -0
  6. data/Gemfile.lock +186 -0
  7. data/Rakefile +51 -0
  8. data/VERSION +1 -0
  9. data/Vagrantfile +128 -0
  10. data/app/controllers/devise/devise_safeguard_controller.rb +56 -0
  11. data/app/views/devise/verify_safeguard.html.erb +9 -0
  12. data/app/views/devise/verify_safeguard.html.haml +7 -0
  13. data/config/locales/pt-BR.yml +5 -0
  14. data/lib/devise-safeguard/controllers/helpers.rb +54 -0
  15. data/lib/devise-safeguard/hooks/safeguard_authenticatable.rb +7 -0
  16. data/lib/devise-safeguard/models/safeguard_authenticatable.rb +18 -0
  17. data/lib/devise-safeguard/rails.rb +7 -0
  18. data/lib/devise-safeguard/routes.rb +17 -0
  19. data/lib/generators/active_record/devise_safeguard_generator.rb +13 -0
  20. data/lib/generators/active_record/templates/migration.rb +15 -0
  21. data/lib/generators/devise_safeguard/devise_safeguard_generator.rb +30 -0
  22. data/lib/generators/devise_safeguard/install_generator.rb +44 -0
  23. data/lib/safeguard-devise.rb +24 -0
  24. data/puppet/manifests/default.pp +66 -0
  25. data/puppet/modules/elasticsearch/CHANGELOG +62 -0
  26. data/puppet/modules/elasticsearch/CONTRIBUTORS +20 -0
  27. data/puppet/modules/elasticsearch/LICENSE +13 -0
  28. data/puppet/modules/elasticsearch/Modulefile +9 -0
  29. data/puppet/modules/elasticsearch/README.md +147 -0
  30. data/puppet/modules/elasticsearch/Rakefile +5 -0
  31. data/puppet/modules/elasticsearch/manifests/config.pp +64 -0
  32. data/puppet/modules/elasticsearch/manifests/init.pp +208 -0
  33. data/puppet/modules/elasticsearch/manifests/java.pp +50 -0
  34. data/puppet/modules/elasticsearch/manifests/package.pp +84 -0
  35. data/puppet/modules/elasticsearch/manifests/params.pp +103 -0
  36. data/puppet/modules/elasticsearch/manifests/plugin.pp +97 -0
  37. data/puppet/modules/elasticsearch/manifests/python.pp +34 -0
  38. data/puppet/modules/elasticsearch/manifests/service.pp +114 -0
  39. data/puppet/modules/elasticsearch/manifests/template.pp +118 -0
  40. data/puppet/modules/elasticsearch/metadata.json +41 -0
  41. data/puppet/modules/elasticsearch/spec/classes/elasticsearch_init_spec.rb +596 -0
  42. data/puppet/modules/elasticsearch/spec/defines/template_spec.rb +66 -0
  43. data/puppet/modules/elasticsearch/spec/spec_helper.rb +2 -0
  44. data/puppet/modules/elasticsearch/templates/etc/default/elasticsearch.erb +5 -0
  45. data/puppet/modules/elasticsearch/templates/etc/elasticsearch/elasticsearch.yml.erb +93 -0
  46. data/puppet/modules/memcached/.gitignore +2 -0
  47. data/puppet/modules/memcached/Modulefile +8 -0
  48. data/puppet/modules/memcached/README.md +29 -0
  49. data/puppet/modules/memcached/manifests/init.pp +33 -0
  50. data/puppet/modules/memcached/manifests/params.pp +21 -0
  51. data/puppet/modules/memcached/templates/memcached.conf.erb +46 -0
  52. data/puppet/modules/memcached/templates/memcached_sysconfig.erb +5 -0
  53. data/puppet/modules/mysql/.fixtures.yml +3 -0
  54. data/puppet/modules/mysql/.gemfile +5 -0
  55. data/puppet/modules/mysql/LICENSE +201 -0
  56. data/puppet/modules/mysql/Modulefile +8 -0
  57. data/puppet/modules/mysql/README.md +124 -0
  58. data/puppet/modules/mysql/files/mysqltuner.pl +966 -0
  59. data/puppet/modules/mysql/lib/puppet/parser/functions/mysql_password.rb +15 -0
  60. data/puppet/modules/mysql/lib/puppet/provider/database/mysql.rb +42 -0
  61. data/puppet/modules/mysql/lib/puppet/provider/database_grant/mysql.rb +177 -0
  62. data/puppet/modules/mysql/lib/puppet/provider/database_user/mysql.rb +42 -0
  63. data/puppet/modules/mysql/lib/puppet/type/database.rb +17 -0
  64. data/puppet/modules/mysql/lib/puppet/type/database_grant.rb +75 -0
  65. data/puppet/modules/mysql/lib/puppet/type/database_user.rb +25 -0
  66. data/puppet/modules/mysql/manifests/backup.pp +68 -0
  67. data/puppet/modules/mysql/manifests/config.pp +122 -0
  68. data/puppet/modules/mysql/manifests/db.pp +77 -0
  69. data/puppet/modules/mysql/manifests/init.pp +24 -0
  70. data/puppet/modules/mysql/manifests/java.pp +24 -0
  71. data/puppet/modules/mysql/manifests/params.pp +91 -0
  72. data/puppet/modules/mysql/manifests/python.pp +26 -0
  73. data/puppet/modules/mysql/manifests/ruby.pp +28 -0
  74. data/puppet/modules/mysql/manifests/server/account_security.pp +13 -0
  75. data/puppet/modules/mysql/manifests/server/monitor.pp +19 -0
  76. data/puppet/modules/mysql/manifests/server/mysqltuner.pp +22 -0
  77. data/puppet/modules/mysql/manifests/server.pp +52 -0
  78. data/puppet/modules/mysql/templates/my.cnf.erb +42 -0
  79. data/puppet/modules/mysql/templates/my.cnf.pass.erb +6 -0
  80. data/puppet/modules/mysql/templates/mysqlbackup.sh.erb +23 -0
  81. data/puppet/modules/postgresql/GPL-3 +674 -0
  82. data/puppet/modules/postgresql/Modulefile +13 -0
  83. data/puppet/modules/postgresql/README.md +156 -0
  84. data/puppet/modules/postgresql/lib/puppet/provider/pg_database/debian_postgresql.rb +30 -0
  85. data/puppet/modules/postgresql/lib/puppet/provider/pg_database/default.rb +17 -0
  86. data/puppet/modules/postgresql/lib/puppet/provider/pg_user/debian_postgresql.rb +63 -0
  87. data/puppet/modules/postgresql/lib/puppet/provider/pg_user/default.rb +17 -0
  88. data/puppet/modules/postgresql/lib/puppet/type/pg_database.rb +29 -0
  89. data/puppet/modules/postgresql/lib/puppet/type/pg_user.rb +45 -0
  90. data/puppet/modules/postgresql/manifests/db.pp +20 -0
  91. data/puppet/modules/postgresql/manifests/init.pp +12 -0
  92. data/puppet/modules/postgresql/manifests/params.pp +15 -0
  93. data/puppet/modules/postgresql/manifests/server.pp +47 -0
  94. data/puppet/modules/postgresql/templates/pg_hba.conf.erb +105 -0
  95. data/puppet/modules/postgresql/templates/postgresql.conf.erb +559 -0
  96. data/puppet/modules/redis/CHANGELOG +41 -0
  97. data/puppet/modules/redis/Gemfile +7 -0
  98. data/puppet/modules/redis/Gemfile.lock +18 -0
  99. data/puppet/modules/redis/Modulefile +10 -0
  100. data/puppet/modules/redis/README.md +34 -0
  101. data/puppet/modules/redis/Rakefile +6 -0
  102. data/puppet/modules/redis/manifests/init.pp +153 -0
  103. data/puppet/modules/redis/manifests/params.pp +39 -0
  104. data/puppet/modules/redis/metadata.json +31 -0
  105. data/puppet/modules/redis/spec/spec_helper.rb +17 -0
  106. data/puppet/modules/redis/templates/redis.debian.conf.erb +217 -0
  107. data/puppet/modules/redis/templates/redis.logrotate.erb +9 -0
  108. data/puppet/modules/redis/templates/redis.rhel.conf.erb +547 -0
  109. data/puppet/modules/redis/tests/init.pp +8 -0
  110. data/puppet/upgrade-puppet.sh +16 -0
  111. data/safeguard-devise.gemspec +249 -0
  112. data/spec/controllers/safeguard_devise_controller_spec.rb +67 -0
  113. data/spec/devise/safeguard_authenticatable_spec.rb +71 -0
  114. data/spec/orm/active_record.rb +4 -0
  115. data/spec/routing/routes_spec.rb +13 -0
  116. data/spec/safeguard-devise-test-app/.gitignore +16 -0
  117. data/spec/safeguard-devise-test-app/Gemfile +14 -0
  118. data/spec/safeguard-devise-test-app/Gemfile.lock +119 -0
  119. data/spec/safeguard-devise-test-app/README.rdoc +28 -0
  120. data/spec/safeguard-devise-test-app/Rakefile +6 -0
  121. data/spec/safeguard-devise-test-app/app/assets/images/.keep +0 -0
  122. data/spec/safeguard-devise-test-app/app/assets/javascripts/application.js +13 -0
  123. data/spec/safeguard-devise-test-app/app/assets/stylesheets/application.css +13 -0
  124. data/spec/safeguard-devise-test-app/app/controllers/application_controller.rb +5 -0
  125. data/spec/safeguard-devise-test-app/app/controllers/concerns/.keep +0 -0
  126. data/spec/safeguard-devise-test-app/app/controllers/home_controller.rb +6 -0
  127. data/spec/safeguard-devise-test-app/app/helpers/application_helper.rb +2 -0
  128. data/spec/safeguard-devise-test-app/app/mailers/.keep +0 -0
  129. data/spec/safeguard-devise-test-app/app/models/.keep +0 -0
  130. data/spec/safeguard-devise-test-app/app/models/concerns/.keep +0 -0
  131. data/spec/safeguard-devise-test-app/app/models/user.rb +6 -0
  132. data/spec/safeguard-devise-test-app/app/views/devise/devise_safeguard/verify_safeguard.html.erb +9 -0
  133. data/spec/safeguard-devise-test-app/app/views/devise/devise_safeguard/verify_safeguard.html.haml +6 -0
  134. data/spec/safeguard-devise-test-app/app/views/home/index.html.erb +1 -0
  135. data/spec/safeguard-devise-test-app/app/views/layouts/application.html.erb +14 -0
  136. data/spec/safeguard-devise-test-app/bin/bundle +3 -0
  137. data/spec/safeguard-devise-test-app/bin/rails +4 -0
  138. data/spec/safeguard-devise-test-app/bin/rake +4 -0
  139. data/spec/safeguard-devise-test-app/config/application.rb +31 -0
  140. data/spec/safeguard-devise-test-app/config/boot.rb +4 -0
  141. data/spec/safeguard-devise-test-app/config/database.yml +25 -0
  142. data/spec/safeguard-devise-test-app/config/environment.rb +5 -0
  143. data/spec/safeguard-devise-test-app/config/environments/development.rb +29 -0
  144. data/spec/safeguard-devise-test-app/config/environments/production.rb +80 -0
  145. data/spec/safeguard-devise-test-app/config/environments/test.rb +36 -0
  146. data/spec/safeguard-devise-test-app/config/initializers/backtrace_silencers.rb +7 -0
  147. data/spec/safeguard-devise-test-app/config/initializers/devise.rb +259 -0
  148. data/spec/safeguard-devise-test-app/config/initializers/filter_parameter_logging.rb +4 -0
  149. data/spec/safeguard-devise-test-app/config/initializers/inflections.rb +16 -0
  150. data/spec/safeguard-devise-test-app/config/initializers/mime_types.rb +5 -0
  151. data/spec/safeguard-devise-test-app/config/initializers/secret_token.rb +12 -0
  152. data/spec/safeguard-devise-test-app/config/initializers/session_store.rb +3 -0
  153. data/spec/safeguard-devise-test-app/config/initializers/wrap_parameters.rb +14 -0
  154. data/spec/safeguard-devise-test-app/config/locales/devise.en.yml +59 -0
  155. data/spec/safeguard-devise-test-app/config/locales/devise.safeguard.pt-BR.yml +5 -0
  156. data/spec/safeguard-devise-test-app/config/locales/en.yml +23 -0
  157. data/spec/safeguard-devise-test-app/config/routes.rb +59 -0
  158. data/spec/safeguard-devise-test-app/config.ru +4 -0
  159. data/spec/safeguard-devise-test-app/db/migrate/20140220191103_create_users.rb +9 -0
  160. data/spec/safeguard-devise-test-app/db/migrate/20140220191247_add_devise_to_users.rb +49 -0
  161. data/spec/safeguard-devise-test-app/db/migrate/20140220191522_devise_safeguard_add_to_users.rb +15 -0
  162. data/spec/safeguard-devise-test-app/db/schema.rb +37 -0
  163. data/spec/safeguard-devise-test-app/db/seeds.rb +7 -0
  164. data/spec/safeguard-devise-test-app/lib/assets/.keep +0 -0
  165. data/spec/safeguard-devise-test-app/lib/tasks/.keep +0 -0
  166. data/spec/safeguard-devise-test-app/log/.keep +0 -0
  167. data/spec/safeguard-devise-test-app/public/404.html +58 -0
  168. data/spec/safeguard-devise-test-app/public/422.html +58 -0
  169. data/spec/safeguard-devise-test-app/public/500.html +57 -0
  170. data/spec/safeguard-devise-test-app/public/favicon.ico +0 -0
  171. data/spec/safeguard-devise-test-app/public/robots.txt +5 -0
  172. data/spec/safeguard-devise-test-app/test/controllers/.keep +0 -0
  173. data/spec/safeguard-devise-test-app/test/fixtures/.keep +0 -0
  174. data/spec/safeguard-devise-test-app/test/fixtures/users.yml +9 -0
  175. data/spec/safeguard-devise-test-app/test/helpers/.keep +0 -0
  176. data/spec/safeguard-devise-test-app/test/integration/.keep +0 -0
  177. data/spec/safeguard-devise-test-app/test/mailers/.keep +0 -0
  178. data/spec/safeguard-devise-test-app/test/models/.keep +0 -0
  179. data/spec/safeguard-devise-test-app/test/models/user_test.rb +7 -0
  180. data/spec/safeguard-devise-test-app/test/test_helper.rb +15 -0
  181. data/spec/safeguard-devise-test-app/vendor/assets/javascripts/.keep +0 -0
  182. data/spec/safeguard-devise-test-app/vendor/assets/stylesheets/.keep +0 -0
  183. data/spec/spec_helper.rb +31 -0
  184. data/spec/tests_helper/helpers.rb +34 -0
  185. metadata +381 -0
@@ -0,0 +1,59 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your account was successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid email or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account will be locked."
15
+ not_found_in_database: "Invalid email or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your account before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock Instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password was changed successfully. You are now signed in."
34
+ updated_not_active: "Your password was changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+ updated: "You updated your account successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ unlocks:
47
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+ errors:
51
+ messages:
52
+ already_confirmed: "was already confirmed, please try signing in"
53
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+ expired: "has expired, please request a new one"
55
+ not_found: "not found"
56
+ not_locked: "was not locked"
57
+ not_saved:
58
+ one: "1 error prohibited this %{resource} from being saved:"
59
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,5 @@
1
+ pt-BR:
2
+ devise:
3
+ safeguard_form_title: Por favor informe a senha do seu token.
4
+ safeguard_token_button: Enviar senha
5
+ safeguard_token: Token
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,59 @@
1
+ SafeguardDeviseTestApp::Application.routes.draw do
2
+ devise_for :users
3
+
4
+ root to: "home#index"
5
+ # The priority is based upon order of creation: first created -> highest priority.
6
+ # See how all your routes lay out with "rake routes".
7
+
8
+ # You can have the root of your site routed with "root"
9
+ # root 'welcome#index'
10
+
11
+ # Example of regular route:
12
+ # get 'products/:id' => 'catalog#view'
13
+
14
+ # Example of named route that can be invoked with purchase_url(id: product.id)
15
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
16
+
17
+ # Example resource route (maps HTTP verbs to controller actions automatically):
18
+ # resources :products
19
+
20
+ # Example resource route with options:
21
+ # resources :products do
22
+ # member do
23
+ # get 'short'
24
+ # post 'toggle'
25
+ # end
26
+ #
27
+ # collection do
28
+ # get 'sold'
29
+ # end
30
+ # end
31
+
32
+ # Example resource route with sub-resources:
33
+ # resources :products do
34
+ # resources :comments, :sales
35
+ # resource :seller
36
+ # end
37
+
38
+ # Example resource route with more complex sub-resources:
39
+ # resources :products do
40
+ # resources :comments
41
+ # resources :sales do
42
+ # get 'recent', on: :collection
43
+ # end
44
+ # end
45
+
46
+ # Example resource route with concerns:
47
+ # concern :toggleable do
48
+ # post 'toggle'
49
+ # end
50
+ # resources :posts, concerns: :toggleable
51
+ # resources :photos, concerns: :toggleable
52
+
53
+ # Example resource route within a namespace:
54
+ # namespace :admin do
55
+ # # Directs /admin/products/* to Admin::ProductsController
56
+ # # (app/controllers/admin/products_controller.rb)
57
+ # resources :products
58
+ # end
59
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,49 @@
1
+ class AddDeviseToUsers < ActiveRecord::Migration
2
+ def self.up
3
+ change_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, :null => false, :default => ""
6
+ t.string :encrypted_password, :null => false, :default => ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, :default => 0, :null => false
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+
34
+ # Uncomment below if timestamps were not included in your original model.
35
+ # t.timestamps
36
+ end
37
+
38
+ add_index :users, :email, :unique => true
39
+ add_index :users, :reset_password_token, :unique => true
40
+ # add_index :users, :confirmation_token, :unique => true
41
+ # add_index :users, :unlock_token, :unique => true
42
+ end
43
+
44
+ def self.down
45
+ # By default, we don't want to make any assumption about how to roll back a migration when your
46
+ # model already existed. Please edit below which fields you would like to remove in this migration.
47
+ raise ActiveRecord::IrreversibleMigration
48
+ end
49
+ end
@@ -0,0 +1,15 @@
1
+ class DeviseSafeguardAddToUsers < ActiveRecord::Migration
2
+ def self.up
3
+ change_table :users do |t|
4
+ t.datetime :last_sign_in_with_safeguard
5
+ t.boolean :safeguard_enabled, :default => false
6
+ end
7
+
8
+ end
9
+
10
+ def self.down
11
+ change_table :users do |t|
12
+ t.remove :last_sign_in_with_safeguard, :safeguard_enabled
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,37 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20140220191522) do
15
+
16
+ create_table "users", force: true do |t|
17
+ t.string "name"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ t.string "email", default: "", null: false
21
+ t.string "encrypted_password", default: "", null: false
22
+ t.string "reset_password_token"
23
+ t.datetime "reset_password_sent_at"
24
+ t.datetime "remember_created_at"
25
+ t.integer "sign_in_count", default: 0, null: false
26
+ t.datetime "current_sign_in_at"
27
+ t.datetime "last_sign_in_at"
28
+ t.string "current_sign_in_ip"
29
+ t.string "last_sign_in_ip"
30
+ t.datetime "last_sign_in_with_safeguard"
31
+ t.boolean "safeguard_enabled", default: false
32
+ end
33
+
34
+ add_index "users", ["email"], name: "index_users_on_email", unique: true
35
+ add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
36
+
37
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
File without changes
File without changes
File without changes
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ name: MyString
5
+ email: MyString
6
+
7
+ two:
8
+ name: MyString
9
+ email: MyString
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,15 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ ActiveRecord::Migration.check_pending!
7
+
8
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
9
+ #
10
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
11
+ # -- they do not yet inherit this setting
12
+ fixtures :all
13
+
14
+ # Add more helper methods to be used by all tests here...
15
+ end
@@ -0,0 +1,31 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+
5
+ require "safeguard-devise-test-app/config/environment"
6
+ require 'rspec/rails'
7
+ require 'safeguard-devise'
8
+ require 'orm/active_record'
9
+ require 'capybara/rails'
10
+ require 'capybara/rspec'
11
+ require 'database_cleaner'
12
+
13
+
14
+
15
+ # Requires supporting files with custom matchers and macros, etc,
16
+ # in ./support/ and its subdirectories.
17
+ Dir["#{File.dirname(__FILE__)}/tests_helper/**/*.rb"].each {|f| require f}
18
+
19
+ RSpec.configure do |config|
20
+ config.before :suite do
21
+ DatabaseCleaner[:active_record].strategy = :truncation
22
+ end
23
+ config.include Capybara::DSL
24
+ config.before :each do
25
+ DatabaseCleaner.start
26
+ end
27
+
28
+ config.after :each do
29
+ DatabaseCleaner.clean
30
+ end
31
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+ def generate_unique_email
3
+ @@email_count ||= 0
4
+ @@email_count += 1
5
+ "test#{@@email_count}@example.com"
6
+ end
7
+
8
+ def valid_attributes(attributes={})
9
+ { :email => generate_unique_email,
10
+ :password => '12345678',
11
+ :password_confirmation => '12345678' }.update(attributes)
12
+ end
13
+
14
+ def new_user(attributes={})
15
+ User.new(valid_attributes(attributes))
16
+ end
17
+
18
+ def create_user(attributes={})
19
+ User.create!(valid_attributes(attributes))
20
+ end
21
+
22
+ def fill_sign_in_form(email, password)
23
+ visit new_user_session_path
24
+ within("#new_user") do
25
+ fill_in 'Email', :with => email
26
+ fill_in 'Password', :with => password
27
+ end
28
+ click_on 'Sign in'
29
+ end
30
+
31
+ def sign_cookie(name, val)
32
+ verifier = ActiveSupport::MessageVerifier.new(SafeguardDeviseTestApp::Application.config.secret_token)
33
+ verifier.generate(val)
34
+ end