mongo_session_store-rails4 5.1.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -3
  3. data/Gemfile +19 -12
  4. data/README.md +6 -4
  5. data/Rakefile +18 -2
  6. data/lib/mongo_session_store/mongo_store.rb +13 -8
  7. data/lib/mongo_session_store/mongo_store_base.rb +2 -1
  8. data/lib/mongo_session_store/version.rb +1 -1
  9. data/mongo_session_store-rails3.gemspec +1 -0
  10. data/mongo_session_store-rails4.gemspec +1 -0
  11. data/spec/rails_3.1_app/config/initializers/session_store.rb +1 -1
  12. data/spec/rails_3.2_app/config/initializers/session_store.rb +1 -1
  13. data/spec/rails_4.0_app/config/initializers/session_store.rb +1 -1
  14. data/spec/rails_4.1_app/config/initializers/session_store.rb +1 -1
  15. data/spec/rails_4.2_app/.gitignore +17 -0
  16. data/spec/rails_4.2_app/Rakefile +6 -0
  17. data/spec/rails_4.2_app/app/assets/images/.keep +0 -0
  18. data/spec/rails_4.2_app/app/assets/javascripts/application.js +13 -0
  19. data/spec/rails_4.2_app/app/assets/stylesheets/application.css +15 -0
  20. data/spec/rails_4.2_app/app/controllers/application_controller.rb +5 -0
  21. data/spec/rails_4.2_app/app/controllers/concerns/.keep +0 -0
  22. data/spec/rails_4.2_app/app/controllers/home_controller.rb +4 -0
  23. data/spec/rails_4.2_app/app/helpers/application_helper.rb +2 -0
  24. data/spec/rails_4.2_app/app/mailers/.keep +0 -0
  25. data/spec/rails_4.2_app/app/models/.keep +0 -0
  26. data/spec/rails_4.2_app/app/models/concerns/.keep +0 -0
  27. data/spec/rails_4.2_app/app/models/user.rb +5 -0
  28. data/spec/rails_4.2_app/app/views/devise/confirmations/new.html.erb +12 -0
  29. data/spec/rails_4.2_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  30. data/spec/rails_4.2_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  31. data/spec/rails_4.2_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  32. data/spec/rails_4.2_app/app/views/devise/passwords/edit.html.erb +16 -0
  33. data/spec/rails_4.2_app/app/views/devise/passwords/new.html.erb +12 -0
  34. data/spec/rails_4.2_app/app/views/devise/registrations/edit.html.erb +29 -0
  35. data/spec/rails_4.2_app/app/views/devise/registrations/new.html.erb +18 -0
  36. data/spec/rails_4.2_app/app/views/devise/sessions/new.html.erb +17 -0
  37. data/spec/rails_4.2_app/app/views/devise/shared/_links.erb +25 -0
  38. data/spec/rails_4.2_app/app/views/devise/unlocks/new.html.erb +12 -0
  39. data/spec/rails_4.2_app/app/views/home/index.html.erb +10 -0
  40. data/spec/rails_4.2_app/app/views/layouts/application.html.erb +17 -0
  41. data/spec/rails_4.2_app/bin/bundle +3 -0
  42. data/spec/rails_4.2_app/bin/rails +8 -0
  43. data/spec/rails_4.2_app/bin/rake +8 -0
  44. data/spec/rails_4.2_app/bin/setup +29 -0
  45. data/spec/rails_4.2_app/bin/spring +15 -0
  46. data/spec/rails_4.2_app/config.ru +4 -0
  47. data/spec/rails_4.2_app/config/application.rb +26 -0
  48. data/spec/rails_4.2_app/config/boot.rb +3 -0
  49. data/spec/rails_4.2_app/config/database.yml +11 -0
  50. data/spec/rails_4.2_app/config/environment.rb +5 -0
  51. data/spec/rails_4.2_app/config/environments/development.rb +41 -0
  52. data/spec/rails_4.2_app/config/environments/production.rb +79 -0
  53. data/spec/rails_4.2_app/config/environments/test.rb +42 -0
  54. data/spec/rails_4.2_app/config/initializers/assets.rb +11 -0
  55. data/spec/rails_4.2_app/config/initializers/backtrace_silencers.rb +7 -0
  56. data/spec/rails_4.2_app/config/initializers/cookies_serializer.rb +3 -0
  57. data/spec/rails_4.2_app/config/initializers/devise.rb +254 -0
  58. data/spec/rails_4.2_app/config/initializers/filter_parameter_logging.rb +4 -0
  59. data/spec/rails_4.2_app/config/initializers/inflections.rb +16 -0
  60. data/spec/rails_4.2_app/config/initializers/mime_types.rb +4 -0
  61. data/spec/rails_4.2_app/config/initializers/session_store.rb +5 -0
  62. data/spec/rails_4.2_app/config/initializers/wrap_parameters.rb +14 -0
  63. data/spec/rails_4.2_app/config/locales/en.yml +23 -0
  64. data/spec/rails_4.2_app/config/mongo.yml +11 -0
  65. data/spec/rails_4.2_app/config/mongoid.yml +13 -0
  66. data/spec/rails_4.2_app/config/routes.rb +4 -0
  67. data/spec/rails_4.2_app/config/secrets.yml +22 -0
  68. data/spec/rails_4.2_app/db/migrate/20140301171212_add_devise_users.rb +11 -0
  69. data/spec/rails_4.2_app/db/schema.rb +25 -0
  70. data/spec/rails_4.2_app/db/seeds.rb +7 -0
  71. data/spec/rails_4.2_app/lib/assets/.keep +0 -0
  72. data/spec/rails_4.2_app/lib/tasks/.keep +0 -0
  73. data/spec/rails_4.2_app/log/.keep +0 -0
  74. data/spec/rails_4.2_app/public/404.html +67 -0
  75. data/spec/rails_4.2_app/public/422.html +67 -0
  76. data/spec/rails_4.2_app/public/500.html +66 -0
  77. data/spec/rails_4.2_app/public/favicon.ico +0 -0
  78. data/spec/rails_4.2_app/public/robots.txt +5 -0
  79. data/spec/rails_helper.rb +1 -1
  80. metadata +133 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2a58fece6febdaa9105032259072e87620fa636
4
- data.tar.gz: e87b45191c8cbca485a31b1390677b0b07fb0fe9
3
+ metadata.gz: 281b4f7e0d7ab3e7f406f6ac88a3a0c198c6e0fe
4
+ data.tar.gz: 626f581c73c25cabd8fb7de5e16216d19ac3c53a
5
5
  SHA512:
6
- metadata.gz: 3a032212829604c3ff2f42037b0ee14a9f172bc6d76390a3752965ff94a2d4a6f51a4669d658a3594a01941ca0ddb0f1e44be4dce68c767b6ee7f124786d166c
7
- data.tar.gz: 8ecec66bc81b715c61a5e95e419d86739080355613ef964abd661711802cbb3c6bec26cb77ddc8158495d3a6cd25262c3528d563fbf1017d0c8ea49ceef7f300
6
+ metadata.gz: 56f257c4daf81557871e4ad70e5cf571bcf25bf674d00b510d2ddafb2bb7f524c02d02d0b7b8270f9565e1ab519af2d0af215b824172424700e05bb2c1b58b73
7
+ data.tar.gz: 6b8957999bf31806567e8aad4fd5aa8451a3b52eaf818c6945e204686669887e1dec9861b68762ecd53abd9b271549144b034395d23b2e9cb27873fa3c019c8f
@@ -3,7 +3,8 @@ script: "rake"
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- - 2.1.2
6
+ - 2.1.5
7
+ - "2.2"
7
8
  - ruby-head
8
9
  - jruby-19mode
9
10
  - jruby-head
@@ -13,5 +14,8 @@ matrix:
13
14
  - rvm: jruby-head
14
15
  - rvm: ruby-head
15
16
  - rvm: rbx-2.2.9
16
- services:
17
- - mongodb
17
+ before_script:
18
+ - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz -O /tmp/mongodb.tgz
19
+ - tar -xvf /tmp/mongodb.tgz
20
+ - mkdir /tmp/data
21
+ - ${PWD}/mongodb-linux-x86_64-3.0.1/bin/mongod --dbpath /tmp/data --bind_ip 127.0.0.1 &> /dev/null &
data/Gemfile CHANGED
@@ -8,33 +8,35 @@ RAILS_VERS = case ENV['RAILS_VERS']
8
8
  when '4.0'
9
9
  '~>4.0.5'
10
10
  when '4.1'
11
- '~>4.1.2.rc2'
11
+ '~>4.1.9'
12
+ when '4.2'
13
+ '~>4.2.0'
12
14
  when nil
13
15
  nil
14
16
  else
15
- raise "Invalid RAILS_VERS. Available versions are 3.2 and 4.0."
17
+ raise "Invalid RAILS_VERS. Available versions are 3.1, 3.2, 4.0, 4.1, and 4.2."
16
18
  end
17
19
 
18
20
  gemspec :name => 'mongo_session_store-rails4'
19
21
 
20
22
  group :development, :test do
21
23
  gem 'rake'
22
- if ENV['MONGO_SESSION_STORE_ORM'] == 'mongo_mapper'
23
- gem 'mongo_mapper', '>= 0.13.0.beta2'
24
- end
25
24
 
26
- if ENV['MONGO_SESSION_STORE_ORM'] == 'mongoid'
25
+ case ENV['MONGO_SESSION_STORE_ORM']
26
+ when 'mongo_mapper'
27
+ gem 'mongo_mapper', '>= 0.13.1'
28
+ when 'mongoid'
27
29
  if ENV['RAILS_VERS'] =~ /^4\.\d/
28
- gem 'mongoid', '>= 4.0.0.beta1'
30
+ gem 'mongoid', '>= 4.0.2'
29
31
  elsif ENV['RAILS_VERS'] =~ /^3\.2\d/
30
32
  gem 'mongoid', '>= 3.1.0'
31
33
  else
32
34
  gem 'mongoid', '>= 3.0.0'
33
35
  end
34
- end
35
-
36
- if ENV['MONGO_SESSION_STORE_ORM'] == 'mongo'
36
+ when 'mongo'
37
37
  gem 'mongo'
38
+ else
39
+ gem 'mongo' # So rake test_all can wait for Mongo to start
38
40
  end
39
41
 
40
42
  gem 'pry'
@@ -48,8 +50,13 @@ group :development, :test do
48
50
  else
49
51
  gem 'sqlite3' # for devise User storage
50
52
  end
51
- RAILS_VERS ? gem('rails', RAILS_VERS) : gem('rails')
52
- gem 'minitest' if ENV['RAILS_VERS'] == '4.1'
53
+
54
+ if RAILS_VERS
55
+ gem 'rails', RAILS_VERS
56
+ else
57
+ gem 'rails'
58
+ end
59
+ gem 'test-unit'
53
60
 
54
61
  gem 'rspec-rails', '2.12.0'
55
62
  gem 'devise'
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  MongoSessionStore is a collection of Rails-compatible session stores for MongoMapper and Mongoid, but also included is a generic Mongo store that works with any (or no!) Mongo ODM.
6
6
 
7
- MongoSessionStore is tested [on Travis CI](https://travis-ci.org/brianhempel/mongo_session_store) against Ruby 1.9.3, 2.0.0, 2.1.2, and JRuby with Rails 3.1 through 4.1.
7
+ MongoSessionStore is tested [on Travis CI](https://travis-ci.org/brianhempel/mongo_session_store) against Ruby 1.9.3, 2.0.0, 2.1.5, 2.2.0, and JRuby with Rails 3.1 through 4.2.
8
8
 
9
9
  Mongoid users: This gem is compatible with both Mongoid 3 and 4.
10
10
 
@@ -14,7 +14,7 @@ See the [Changelog](#changelog) if you need support for an older version of Ruby
14
14
 
15
15
  ## Usage
16
16
 
17
- MongoSessionStore is compatible with Rails 3.1 through 4.1.
17
+ MongoSessionStore is compatible with Rails 3.1 through 4.2.
18
18
 
19
19
  In your Gemfile:
20
20
 
@@ -37,7 +37,7 @@ MyApp::Application.config.session_store :mongoid_store
37
37
 
38
38
  # anything else
39
39
  MyApp::Application.config.session_store :mongo_store
40
- MongoStore::Session.database = Mongo::Connection.new.db('my_app_development')
40
+ MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: \"my_app_development\")
41
41
  ```
42
42
 
43
43
  By default, the sessions will be stored in the "sessions" collection in MongoDB. If you want to use a different collection, you can set that in the initializer:
@@ -61,6 +61,8 @@ MongoStore::Session.where('updated_at' => { '$gt' => 2.days.ago })
61
61
 
62
62
  ## Changelog
63
63
 
64
+ 6.0.0 supports the Mongo Ruby Driver 2.0 for the generic MongoStore. The other stores are unchanged. Tests added for Rails 4.2. Tests against MongoDB 3.0.1 on Travis CI.
65
+
64
66
  5.1.0 generates a new session ID when a session is not found. Previously, when a session ID is provided in the request but the session was not found (because for example, it was removed from Mongo by a sweeper job) a new session with the provided ID would be created. This would cause a write error if two simultaneous requests both create a session with the same ID and both try to insert a new document with that ID.
65
67
 
66
68
  5.0.1 suppresses a warning from Mongoid 4 when setting the _id field type to String.
@@ -87,7 +89,7 @@ To run the tests for a specific store (examples):
87
89
  To see a list of all options for running tests, run
88
90
 
89
91
  rake -T
90
-
92
+
91
93
  ## Previous contributors
92
94
 
93
95
  MongoSessionStore started as a fork of the DataMapper session store, modified to work with MongoMapper and Mongoid. Much thanks to all the previous contributors:
data/Rakefile CHANGED
@@ -20,15 +20,31 @@ def set_versions(rails_vers, orm)
20
20
  success
21
21
  end
22
22
 
23
- @rails_versions = ['3.1', '3.2', '4.0', '4.1']
23
+ @rails_versions = ['3.1', '3.2', '4.0', '4.1', '4.2']
24
24
  @orms = ['mongo_mapper', 'mongoid', 'mongo']
25
25
 
26
26
  task :default => :test_all
27
27
 
28
- desc 'Test each session store against Rails 3.1, 3.2, 4.0, and 4.1'
28
+ desc 'Test each session store against Rails 3.1, 3.2, 4.0, 4.1, and 4.2'
29
29
  task :test_all do
30
30
  # inspired by http://pivotallabs.com/users/jdean/blog/articles/1728-testing-your-gem-against-multiple-rubies-and-rails-versions-with-rvm
31
31
 
32
+ # Wait for mongod to start on Travis.
33
+ # From the Mongo Ruby Driver gem.
34
+ if ENV['TRAVIS']
35
+ require 'mongo'
36
+ client = Mongo::Client.new(['127.0.0.1:27017'])
37
+ begin
38
+ puts "Waiting for MongoDB..."
39
+ client.command(Mongo::Server::Monitor::STATUS)
40
+ rescue Mongo::ServerSelector::NoServerAvailable => e
41
+ sleep(2)
42
+ # 1 Retry
43
+ puts "Waiting for MongoDB..."
44
+ client.cluster.scan!
45
+ client.command(Mongo::ServerSelector::NoServerAvailable)
46
+ end
47
+ end
32
48
 
33
49
  @failed_suites = []
34
50
 
@@ -9,7 +9,7 @@ module ActionDispatch
9
9
 
10
10
  def initialize(options = {})
11
11
  @_id = options[:_id]
12
- @data = options[:data] || BSON::Binary.new(Marshal.dump({}))
12
+ @data = options[:data] || BSON::Binary.new(Marshal.dump({}), :generic)
13
13
  @created_at = options[:created_at]
14
14
  @updated_at = options[:updated_at]
15
15
  end
@@ -19,20 +19,25 @@ module ActionDispatch
19
19
  new(options)
20
20
  end
21
21
 
22
+ def scope
23
+ collection.find(:_id => _id)
24
+ end
25
+
22
26
  def destroy
23
- collection.remove :_id => _id
27
+ scope.delete_one
24
28
  end
25
29
 
26
30
  def save
27
31
  @created_at ||= Time.now
28
32
  @updated_at = Time.now
29
-
30
- collection.save(
31
- :_id => @_id,
32
- :data => BSON::Binary.new(@data),
33
+
34
+ attributes = {
35
+ :data => BSON::Binary.new(@data, :generic),
33
36
  :created_at => @created_at,
34
37
  :updated_at => @updated_at
35
- )
38
+ }
39
+
40
+ scope.replace_one(attributes, upsert: true)
36
41
  end
37
42
 
38
43
  def data=(stuff)
@@ -51,7 +56,7 @@ module ActionDispatch
51
56
  if @database
52
57
  @database
53
58
  else
54
- raise "MongoStore needs a database, e.g. MongoStore::Session.database = Mongo::Connection.new.db('my_app_development')"
59
+ raise "MongoStore needs a database, e.g. MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: \"my_app_development\")"
55
60
  end
56
61
  end
57
62
 
@@ -72,7 +72,8 @@ module ActionDispatch
72
72
 
73
73
  def unpack(packed)
74
74
  return nil unless packed
75
- Marshal.load(StringIO.new(packed.to_s))
75
+ data = packed.respond_to?(:data) ? packed.data : packed.to_s
76
+ Marshal.load(StringIO.new(data))
76
77
  end
77
78
 
78
79
  end
@@ -1,3 +1,3 @@
1
1
  module MongoSessionStore
2
- VERSION = "5.1.0"
2
+ VERSION = "6.0.0"
3
3
  end
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.files = `git ls-files`.split("\n")
10
10
  s.test_files = `git ls-files -- {test,spec,features,perf}/*`.split("\n")
11
11
  s.homepage = "http://github.com/brianhempel/mongo_session_store"
12
+ s.license = "MIT"
12
13
  s.require_paths = ["lib"]
13
14
  s.rubygems_version = "1.3.7"
14
15
  s.summary = "Rails session stores for MongoMapper, Mongoid, or any other ODM. Rails 3.1, 3.2, 4.0, and 4.1 compatible."
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.files = `git ls-files`.split("\n")
10
10
  s.test_files = `git ls-files -- {test,spec,features,perf}/*`.split("\n")
11
11
  s.homepage = "http://github.com/brianhempel/mongo_session_store"
12
+ s.license = "MIT"
12
13
  s.require_paths = ["lib"]
13
14
  s.rubygems_version = "1.3.7"
14
15
  s.summary = "Rails session stores for MongoMapper, Mongoid, or any other ODM. Rails 3.1, 3.2, 4.0, and 4.1 compatible."
@@ -5,5 +5,5 @@
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
7
7
  # (create the session table with "rails generate session_migration")
8
- MongoStore::Session.database = Mongo::Connection.new.db("rails31_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
8
+ MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails31_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
9
9
  Rails31App::Application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
@@ -5,5 +5,5 @@
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
7
7
  # (create the session table with "rails generate session_migration")
8
- MongoStore::Session.database = Mongo::Connection.new.db("rails32_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
8
+ MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails32_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
9
9
  Rails32App::Application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
@@ -1,5 +1,5 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Rails40App::Application.config.session_store :cookie_store, key: '_rails_4_0_app_session'
4
- MongoStore::Session.database = Mongo::Connection.new.db("rails40_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
4
+ MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails40_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
5
5
  Rails40App::Application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
@@ -1,5 +1,5 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Rails.application.config.session_store :cookie_store, key: '_rails_41_app_session'
4
- MongoStore::Session.database = Mongo::Connection.new.db("rails41_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
4
+ MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails41_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
5
5
  Rails.application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
@@ -0,0 +1,17 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ !/log/.keep
17
+ /tmp
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,4 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ class User < ActiveRecord::Base
2
+ # Include default devise modules. Others available are:
3
+ # :confirmable, :lockable, :timeoutable and :omniauthable
4
+ devise :database_authenticatable, :registerable
5
+ end
@@ -0,0 +1,12 @@
1
+ <h2>Resend confirmation instructions</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email, :autofocus => true %></div>
8
+
9
+ <div><%= f.submit "Resend confirmation instructions" %></div>
10
+ <% end %>
11
+
12
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,5 @@
1
+ <p>Welcome <%= @email %>!</p>
2
+
3
+ <p>You can confirm your account email through the link below:</p>
4
+
5
+ <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %></p>
@@ -0,0 +1,8 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Someone has requested a link to change your password. You can do this through the link below.</p>
4
+
5
+ <p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %></p>
6
+
7
+ <p>If you didn't request this, please ignore this email.</p>
8
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
4
+
5
+ <p>Click the link below to unlock your account:</p>
6
+
7
+ <p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %></p>
@@ -0,0 +1,16 @@
1
+ <h2>Change your password</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+ <%= f.hidden_field :reset_password_token %>
6
+
7
+ <div><%= f.label :password, "New password" %><br />
8
+ <%= f.password_field :password, :autofocus => true %></div>
9
+
10
+ <div><%= f.label :password_confirmation, "Confirm new password" %><br />
11
+ <%= f.password_field :password_confirmation %></div>
12
+
13
+ <div><%= f.submit "Change my password" %></div>
14
+ <% end %>
15
+
16
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,12 @@
1
+ <h2>Forgot your password?</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email, :autofocus => true %></div>
8
+
9
+ <div><%= f.submit "Send me reset password instructions" %></div>
10
+ <% end %>
11
+
12
+ <%= render "devise/shared/links" %>