janus 0.5.0
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.
- data/README.rdoc +144 -0
- data/lib/janus/config.rb +26 -0
- data/lib/janus/controllers/confirmations_controller.rb +56 -0
- data/lib/janus/controllers/helpers.rb +54 -0
- data/lib/janus/controllers/internal_helpers.rb +33 -0
- data/lib/janus/controllers/passwords_controller.rb +60 -0
- data/lib/janus/controllers/registrations_controller.rb +55 -0
- data/lib/janus/controllers/sessions_controller.rb +94 -0
- data/lib/janus/controllers/url_helpers.rb +61 -0
- data/lib/janus/helper.rb +11 -0
- data/lib/janus/hooks/rememberable.rb +20 -0
- data/lib/janus/hooks/remote_authenticatable.rb +27 -0
- data/lib/janus/hooks/trackable.rb +3 -0
- data/lib/janus/hooks.rb +58 -0
- data/lib/janus/mailer.rb +13 -0
- data/lib/janus/manager.rb +97 -0
- data/lib/janus/models/base.rb +31 -0
- data/lib/janus/models/confirmable.rb +45 -0
- data/lib/janus/models/database_authenticatable.rb +98 -0
- data/lib/janus/models/rememberable.rb +54 -0
- data/lib/janus/models/remote_authenticatable.rb +99 -0
- data/lib/janus/models/remote_token.rb +17 -0
- data/lib/janus/models/trackable.rb +37 -0
- data/lib/janus/routes.rb +78 -0
- data/lib/janus/strategies/base.rb +40 -0
- data/lib/janus/strategies/database_authenticatable.rb +20 -0
- data/lib/janus/strategies/rememberable.rb +52 -0
- data/lib/janus/strategies/remote_authenticatable.rb +28 -0
- data/lib/janus/strategies.rb +33 -0
- data/lib/janus/test_helper.rb +25 -0
- data/lib/janus.rb +60 -0
- data/test/functional/home_controller_test.rb +8 -0
- data/test/functional/janus/mailer_test.rb +14 -0
- data/test/functional/janus/manager_test.rb +94 -0
- data/test/functional/users/confirmations_controller_test.rb +59 -0
- data/test/functional/users/passwords_controller_test.rb +101 -0
- data/test/functional/users/registrations_controller_test.rb +112 -0
- data/test/functional/users/sessions_controller_test.rb +100 -0
- data/test/functional/users_controller_test.rb +22 -0
- data/test/integration/users/rememberable_test.rb +32 -0
- data/test/integration/users/remote_test.rb +72 -0
- data/test/integration/users/sessions_test.rb +18 -0
- data/test/integration/users/trackable_test.rb +22 -0
- data/test/rails_app/app/controllers/application_controller.rb +9 -0
- data/test/rails_app/app/controllers/blogs_controller.rb +6 -0
- data/test/rails_app/app/controllers/home_controller.rb +4 -0
- data/test/rails_app/app/controllers/users/confirmations_controller.rb +3 -0
- data/test/rails_app/app/controllers/users/passwords_controller.rb +3 -0
- data/test/rails_app/app/controllers/users/registrations_controller.rb +7 -0
- data/test/rails_app/app/controllers/users/sessions_controller.rb +11 -0
- data/test/rails_app/app/controllers/users_controller.rb +9 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/rails_app/app/mailers/janus_mailer.rb +2 -0
- data/test/rails_app/app/models/remote_token.rb +6 -0
- data/test/rails_app/app/models/user.rb +8 -0
- data/test/rails_app/config/application.rb +42 -0
- data/test/rails_app/config/boot.rb +6 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +26 -0
- data/test/rails_app/config/environments/production.rb +49 -0
- data/test/rails_app/config/environments/test.rb +36 -0
- data/test/rails_app/config/initializers/janus.rb +11 -0
- data/test/rails_app/config/initializers/secret_token.rb +7 -0
- data/test/rails_app/config/initializers/session_store.rb +8 -0
- data/test/rails_app/config/routes.rb +12 -0
- data/test/rails_app/db/migrate/20110323153820_create_users.rb +34 -0
- data/test/rails_app/db/migrate/20110331153546_create_remote_tokens.rb +15 -0
- data/test/rails_app/db/schema.rb +45 -0
- data/test/rails_app/db/seeds.rb +7 -0
- data/test/test_helper.rb +103 -0
- data/test/unit/confirmable_test.rb +36 -0
- data/test/unit/janus_test.rb +27 -0
- data/test/unit/rememberable_test.rb +50 -0
- data/test/unit/remote_authenticatable_test.rb +37 -0
- data/test/unit/remote_token_test.rb +9 -0
- data/test/unit/reset_password_test.rb +45 -0
- data/test/unit/trackable_test.rb +21 -0
- data/test/unit/user_test.rb +60 -0
- metadata +232 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class UsersControllerTest < ActionController::TestCase
|
4
|
+
[:julien, :martha].each do |name|
|
5
|
+
test "#{name} should get show" do
|
6
|
+
sign_in users(name)
|
7
|
+
get :show
|
8
|
+
assert_response :ok
|
9
|
+
assert_select 'h1', 'Welcome ' + users(name).email
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
test "should not get show" do
|
14
|
+
get :show
|
15
|
+
assert_redirected_to new_user_session_url
|
16
|
+
end
|
17
|
+
|
18
|
+
test "should not get show as xml" do
|
19
|
+
get :show, :format => 'xml'
|
20
|
+
assert_response :unauthorized
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Users::RememberableTest < ActionDispatch::IntegrationTest
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
test "should remember user across sessions" do
|
7
|
+
sign_in users(:julien), :remember_me => true
|
8
|
+
assert_authenticated
|
9
|
+
|
10
|
+
close_user_session
|
11
|
+
|
12
|
+
visit root_url
|
13
|
+
assert_authenticated
|
14
|
+
|
15
|
+
sign_out :user
|
16
|
+
visit root_url
|
17
|
+
assert_not_authenticated
|
18
|
+
end
|
19
|
+
|
20
|
+
test "registration should remember user" do
|
21
|
+
sign_up({ :email => 'toto@example.com', :password => 'my password' }, :scope => :user)
|
22
|
+
assert_authenticated
|
23
|
+
close_user_session
|
24
|
+
|
25
|
+
visit root_url
|
26
|
+
assert_authenticated
|
27
|
+
|
28
|
+
sign_out :user
|
29
|
+
visit root_url
|
30
|
+
assert_not_authenticated
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Users::RemoteTest < ActionDispatch::IntegrationTest
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
test "service login" do
|
7
|
+
# user visits a remote site
|
8
|
+
visit blog_url(:host => 'test.host')
|
9
|
+
assert_not_authenticated
|
10
|
+
|
11
|
+
# user clicks the sign in link
|
12
|
+
click_link 'sign_in'
|
13
|
+
assert_match Regexp.new('^' + Regexp.quote(new_user_session_url(:return_to => '')) + '.+'), current_url
|
14
|
+
assert_select 'input[name=return_to]'
|
15
|
+
assert_select '#user_email'
|
16
|
+
assert_select '#user_password'
|
17
|
+
|
18
|
+
# user signs in and should be redirected to remote site
|
19
|
+
fill_in 'user_email', :with => users(:julien).email
|
20
|
+
fill_in 'user_password', :with => 'secret'
|
21
|
+
find('input[name=commit]').click
|
22
|
+
assert_match Regexp.new('^' + Regexp.quote(blog_url(:host => 'test.host', :remote_token => '')) + '.+'), current_url
|
23
|
+
|
24
|
+
# user should be authenticated on remote site
|
25
|
+
assert_authenticated
|
26
|
+
end
|
27
|
+
|
28
|
+
test "service login with signed in user" do
|
29
|
+
# user signs in on main site
|
30
|
+
sign_in users(:julien)
|
31
|
+
|
32
|
+
# user visits a remote site
|
33
|
+
visit blog_url(:host => 'test.host')
|
34
|
+
assert_not_authenticated
|
35
|
+
|
36
|
+
# user clicks the sign in link of remote site which should redirect her back
|
37
|
+
click_link 'sign_in'
|
38
|
+
assert_match Regexp.new('^' + Regexp.quote(blog_url(:host => 'test.host', :remote_token => '')) + '.+'), current_url
|
39
|
+
|
40
|
+
# user should have been transparently logged in
|
41
|
+
assert_authenticated
|
42
|
+
end
|
43
|
+
|
44
|
+
test "single sign out" do
|
45
|
+
# user signs in on main and remote site
|
46
|
+
sign_in users(:julien)
|
47
|
+
service_login :user, :return_to => root_url(:host => 'test.host')
|
48
|
+
|
49
|
+
# user signs out from main site
|
50
|
+
sign_out :user
|
51
|
+
|
52
|
+
# somebody visits the remote site using the user session
|
53
|
+
visit root_url(:host => 'test.host')
|
54
|
+
|
55
|
+
# session should have been invalidated
|
56
|
+
assert_not_authenticated
|
57
|
+
end
|
58
|
+
|
59
|
+
test "session invalidation should not reset the user session_token" do
|
60
|
+
sign_in users(:julien)
|
61
|
+
service_login :user, :return_to => root_url(:host => 'test.host')
|
62
|
+
|
63
|
+
sign_out :user
|
64
|
+
sign_in users(:julien)
|
65
|
+
|
66
|
+
visit root_url(:host => 'test.host')
|
67
|
+
assert_not_authenticated
|
68
|
+
|
69
|
+
visit root_url
|
70
|
+
assert_authenticated
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Users::SessionsTest < ActionDispatch::IntegrationTest
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
test "sign in and out" do
|
7
|
+
visit new_user_session_path
|
8
|
+
fill_in 'user_email', :with => users(:julien).email
|
9
|
+
fill_in 'user_password', :with => 'secret'
|
10
|
+
find('input[name=commit]').click
|
11
|
+
|
12
|
+
assert_equal user_path, page.current_path
|
13
|
+
find('h1').has_content?('Welcome ' + users(:julien).email)
|
14
|
+
|
15
|
+
visit destroy_user_session_path
|
16
|
+
assert_equal root_path, page.current_path
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Users::TrackableTest < ActionDispatch::IntegrationTest
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
test "should track user" do
|
7
|
+
current_sign_in_at = users(:julien).reload.current_sign_in_at
|
8
|
+
sign_in users(:julien)
|
9
|
+
assert_not_equal current_sign_in_at, users(:julien).reload.current_sign_in_at
|
10
|
+
end
|
11
|
+
|
12
|
+
test "remote authentication should not track user" do
|
13
|
+
sign_in users(:julien)
|
14
|
+
|
15
|
+
current_sign_in_at = users(:julien).reload.current_sign_in_at
|
16
|
+
|
17
|
+
visit root_url(:host => 'test.host')
|
18
|
+
click_link 'sign_in'
|
19
|
+
|
20
|
+
assert_equal current_sign_in_at, users(:julien).reload.current_sign_in_at
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
include Janus::Models::Base
|
3
|
+
include Janus::Models::DatabaseAuthenticatable
|
4
|
+
include Janus::Models::Confirmable
|
5
|
+
include Janus::Models::Rememberable
|
6
|
+
include Janus::Models::RemoteAuthenticatable
|
7
|
+
include Janus::Models::Trackable
|
8
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "rails/all"
|
4
|
+
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
+
|
9
|
+
module RailsApp
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
+
|
18
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
+
|
22
|
+
# Activate observers that should always be running.
|
23
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
+
|
25
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
+
|
29
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
+
# config.i18n.default_locale = :de
|
32
|
+
|
33
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
34
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
35
|
+
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
+
config.encoding = "utf-8"
|
38
|
+
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
+
config.filter_parameters += [:password]
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
config.action_mailer.default_url_options = { :host => 'www.example.com' }
|
28
|
+
|
29
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
30
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
31
|
+
# like if you have constraints or database-specific column types
|
32
|
+
# config.active_record.schema_format = :sql
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Janus.config do |config|
|
2
|
+
config.contact_email = "contact@example.com"
|
3
|
+
|
4
|
+
# DatabaseAuthenticatable
|
5
|
+
config.authentication_keys = [:email]
|
6
|
+
config.stretches = 10
|
7
|
+
config.pepper = "db5ef161873f4b4cd966ff042c448282e8243a0a4e090347370360796ecc769f384d898badda1881bc7ed4483f20f6809b39a54f6671cc35cda18bfe554cd8e0"
|
8
|
+
|
9
|
+
# RemoteAuthenticatable
|
10
|
+
# ...
|
11
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
RailsApp::Application.config.secret_token = 'c6a67697877c66be70cdcc4680f37593045a721cf757de4110f9749877cb32f94fe4ddaa5e816af4555d91c4f6142a401972474d50fe620d41ede300d3143d4a'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
RailsApp::Application.config.session_store :cookie_store, :key => '_rails_app_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# RailsApp::Application.config.session_store :active_record_store
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :users do |t|
|
4
|
+
t.string :email
|
5
|
+
t.string :encrypted_password
|
6
|
+
|
7
|
+
t.string :reset_password_token
|
8
|
+
t.datetime :reset_password_sent_at
|
9
|
+
|
10
|
+
t.string :remember_token
|
11
|
+
t.datetime :remember_created_at
|
12
|
+
|
13
|
+
t.string :confirmation_token
|
14
|
+
t.datetime :confirmation_sent_at
|
15
|
+
t.datetime :confirmed_at
|
16
|
+
|
17
|
+
t.string :session_token
|
18
|
+
|
19
|
+
t.integer :sign_in_count, :default => 0
|
20
|
+
t.string :last_sign_in_at
|
21
|
+
t.string :last_sign_in_ip
|
22
|
+
t.string :current_sign_in_at
|
23
|
+
t.string :current_sign_in_ip
|
24
|
+
end
|
25
|
+
|
26
|
+
add_index :users, :email, :unique => true
|
27
|
+
add_index :users, :remember_token, :unique => true
|
28
|
+
add_index :users, :reset_password_token, :unique => true
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.down
|
32
|
+
drop_table :users
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateRemoteTokens < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :remote_tokens do |t|
|
4
|
+
t.references :user
|
5
|
+
t.string :token
|
6
|
+
t.datetime :created_at
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :remote_tokens, :token, :unique => true
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :remote_tokens
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,45 @@
|
|
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 => 20110331153546) do
|
14
|
+
|
15
|
+
create_table "remote_tokens", :force => true do |t|
|
16
|
+
t.integer "user_id"
|
17
|
+
t.string "token"
|
18
|
+
t.datetime "created_at"
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index "remote_tokens", ["token"], :name => "index_remote_tokens_on_token", :unique => true
|
22
|
+
|
23
|
+
create_table "users", :force => true do |t|
|
24
|
+
t.string "email"
|
25
|
+
t.string "encrypted_password"
|
26
|
+
t.string "reset_password_token"
|
27
|
+
t.datetime "reset_password_sent_at"
|
28
|
+
t.string "remember_token"
|
29
|
+
t.datetime "remember_created_at"
|
30
|
+
t.string "confirmation_token"
|
31
|
+
t.datetime "confirmation_sent_at"
|
32
|
+
t.datetime "confirmed_at"
|
33
|
+
t.string "session_token"
|
34
|
+
t.integer "sign_in_count", :default => 0
|
35
|
+
t.string "last_sign_in_at"
|
36
|
+
t.string "last_sign_in_ip"
|
37
|
+
t.string "current_sign_in_at"
|
38
|
+
t.string "current_sign_in_ip"
|
39
|
+
end
|
40
|
+
|
41
|
+
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
42
|
+
add_index "users", ["remember_token"], :name => "index_users_on_remember_token", :unique => true
|
43
|
+
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
44
|
+
|
45
|
+
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 => 'Daley', :city => cities.first)
|