janus 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +3 -0
- data/.gitignore +4 -0
- data/.travis.yml +18 -0
- data/LICENSE +20 -0
- data/README.rdoc +4 -5
- data/Rakefile +22 -0
- data/VERSION +1 -0
- data/certs/ysbaddaden.pem +21 -0
- data/janus.gemspec +28 -0
- data/lib/generators/janus/resource_generator.rb +17 -1
- data/lib/generators/templates/janus.rb +9 -5
- data/lib/generators/templates/mailer.rb +3 -0
- data/lib/generators/templates/mailer/confirmation_instructions.html.erb +7 -0
- data/lib/generators/templates/mailer/confirmation_instructions.text.erb +7 -0
- data/lib/generators/templates/mailer/reset_password_instructions.html.erb +9 -0
- data/lib/generators/templates/mailer/reset_password_instructions.text.erb +7 -0
- data/lib/janus.rb +3 -0
- data/lib/janus/config.rb +9 -3
- data/lib/janus/controllers/confirmations_controller.rb +1 -1
- data/lib/janus/controllers/internal_helpers.rb +8 -1
- data/lib/janus/controllers/passwords_controller.rb +1 -1
- data/lib/janus/controllers/registrations_controller.rb +1 -1
- data/lib/janus/controllers/sessions_controller.rb +6 -5
- data/lib/janus/models/confirmable.rb +2 -0
- data/lib/janus/models/database_authenticatable.rb +4 -2
- data/lib/janus/models/rememberable.rb +2 -0
- data/lib/janus/models/remote_authenticatable.rb +2 -0
- data/lib/janus/models/remote_token.rb +6 -5
- data/lib/janus/models/token_authenticatable.rb +79 -0
- data/lib/janus/models/trackable.rb +2 -0
- data/lib/janus/strategies.rb +1 -1
- data/lib/janus/strategies/token_authenticatable.rb +22 -0
- data/lib/janus/version.rb +10 -0
- data/test/fixtures/admins.yml +5 -0
- data/test/fixtures/users.yml +10 -0
- data/test/functional/admins/sessions_controller_test.rb +13 -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 +68 -0
- data/test/functional/users/passwords_controller_test.rb +131 -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 +29 -0
- data/test/generators/install_generator_test.rb +16 -0
- data/test/generators/resource_generator_test.rb +80 -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/token_authenticatable_test.rb +42 -0
- data/test/integration/users/trackable_test.rb +22 -0
- data/test/rails_app/.gitignore +4 -0
- data/test/rails_app/Rakefile +7 -0
- data/test/rails_app/app/controllers/admins/sessions_controller.rb +11 -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 +17 -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/user_mailer.rb +3 -0
- data/test/rails_app/app/models/admin.rb +3 -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/app/views/admins/sessions/new.html.erb +30 -0
- data/test/rails_app/app/views/blogs/show.html.erb +2 -0
- data/test/rails_app/app/views/home/index.html.erb +2 -0
- data/test/rails_app/app/views/layouts/application.html.erb +28 -0
- data/test/rails_app/app/views/user_mailer/confirmation_instructions.html.erb +7 -0
- data/test/rails_app/app/views/user_mailer/confirmation_instructions.text.erb +7 -0
- data/test/rails_app/app/views/user_mailer/reset_password_instructions.html.erb +9 -0
- data/test/rails_app/app/views/user_mailer/reset_password_instructions.text.erb +7 -0
- data/test/rails_app/app/views/users/confirmations/new.html.erb +16 -0
- data/test/rails_app/app/views/users/passwords/edit.html.erb +21 -0
- data/test/rails_app/app/views/users/passwords/new.html.erb +16 -0
- data/test/rails_app/app/views/users/registrations/edit.html.erb +31 -0
- data/test/rails_app/app/views/users/registrations/new.html.erb +26 -0
- data/test/rails_app/app/views/users/sessions/new.html.erb +30 -0
- data/test/rails_app/app/views/users/show.html.erb +2 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +43 -0
- data/test/rails_app/config/boot.rb +6 -0
- data/test/rails_app/config/database.yml +22 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +23 -0
- data/test/rails_app/config/environments/production.rb +50 -0
- data/test/rails_app/config/environments/test.rb +34 -0
- data/test/rails_app/config/initializers/janus.rb +25 -0
- data/test/rails_app/config/initializers/secret_token.rb +8 -0
- data/test/rails_app/config/initializers/session_store.rb +8 -0
- data/test/rails_app/config/locales/janus.en.yml +65 -0
- data/test/rails_app/config/routes.rb +13 -0
- data/test/rails_app/db/migrate/20110323153820_create_users.rb +40 -0
- data/test/rails_app/db/migrate/20110331153546_create_remote_tokens.rb +15 -0
- data/test/rails_app/db/migrate/20130412104138_create_admins.rb +10 -0
- data/test/rails_app/db/schema.rb +58 -0
- data/test/rails_app/db/seeds.rb +7 -0
- data/test/rails_app/lib/tasks/.gitkeep +0 -0
- data/test/rails_app/public/404.html +26 -0
- data/test/rails_app/public/422.html +26 -0
- data/test/rails_app/public/500.html +26 -0
- data/test/rails_app/script/rails +6 -0
- data/test/test_helper.rb +121 -0
- data/test/unit/confirmable_test.rb +36 -0
- data/test/unit/janus_test.rb +27 -0
- data/test/unit/rememberable_test.rb +47 -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/token_authenticatable_test.rb +41 -0
- data/test/unit/trackable_test.rb +21 -0
- data/test/unit/user_test.rb +68 -0
- metadata +303 -21
- metadata.gz.sig +0 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
<h1><%= t 'janus.sessions.new.sign_in' %></h1>
|
2
|
+
|
3
|
+
<%= form_for resource, :as => resource_name, :url => session_path(janus_scope), :method => :post do |f| %>
|
4
|
+
<%= hidden_field_tag :return_to, params[:return_to] if params[:return_to] %>
|
5
|
+
|
6
|
+
<%= janus_error_messages %>
|
7
|
+
|
8
|
+
<% resource_class.authentication_keys.each do |key| %>
|
9
|
+
<div class="field">
|
10
|
+
<%= f.label key %>
|
11
|
+
<%= f.text_field key %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div class="field">
|
16
|
+
<%= f.label :password %>
|
17
|
+
<%= f.password_field :password %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<% if resource.respond_to?(:remember_me!) %>
|
21
|
+
<div class="field">
|
22
|
+
<%= check_box_tag :remember_me, '1' %>
|
23
|
+
<%= label_tag :remember_me, resource_class.human_attribute_name(:remember_me) %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<div class="actions">
|
28
|
+
<%= f.submit t('janus.sessions.new.sign_in_btn') %>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
@@ -0,0 +1,43 @@
|
|
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
|
+
config.i18n.enforce_available_locales = true
|
33
|
+
|
34
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
35
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
36
|
+
|
37
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
38
|
+
config.encoding = "utf-8"
|
39
|
+
|
40
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
41
|
+
config.filter_parameters += [:current_password, :password, :password_confirmation]
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,23 @@
|
|
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
|
+
config.eager_load = false
|
9
|
+
|
10
|
+
# Show full error reports and disable caching
|
11
|
+
config.consider_all_requests_local = true
|
12
|
+
config.action_controller.perform_caching = false
|
13
|
+
|
14
|
+
# Don't care if the mailer can't send
|
15
|
+
config.action_mailer.raise_delivery_errors = false
|
16
|
+
|
17
|
+
# Print deprecation notices to the Rails logger
|
18
|
+
config.active_support.deprecation = :log
|
19
|
+
|
20
|
+
# Only use best-standards-support built into browsers
|
21
|
+
config.action_dispatch.best_standards_support = :builtin
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,50 @@
|
|
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
|
+
config.eager_load = true
|
8
|
+
|
9
|
+
# Full error reports are disabled and caching is turned on
|
10
|
+
config.consider_all_requests_local = false
|
11
|
+
config.action_controller.perform_caching = true
|
12
|
+
|
13
|
+
# Specifies the header that your server uses for sending files
|
14
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
15
|
+
|
16
|
+
# For nginx:
|
17
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
18
|
+
|
19
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
20
|
+
# just comment this out and Rails will serve the files
|
21
|
+
|
22
|
+
# See everything in the log (default is :info)
|
23
|
+
# config.log_level = :debug
|
24
|
+
|
25
|
+
# Use a different logger for distributed setups
|
26
|
+
# config.logger = SyslogLogger.new
|
27
|
+
|
28
|
+
# Use a different cache store in production
|
29
|
+
# config.cache_store = :mem_cache_store
|
30
|
+
|
31
|
+
# Disable Rails's static asset server
|
32
|
+
# In production, Apache or nginx will already do this
|
33
|
+
config.serve_static_assets = false
|
34
|
+
|
35
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
36
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
37
|
+
|
38
|
+
# Disable delivery errors, bad email addresses will be ignored
|
39
|
+
# config.action_mailer.raise_delivery_errors = false
|
40
|
+
|
41
|
+
# Enable threaded mode
|
42
|
+
# config.threadsafe!
|
43
|
+
|
44
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
45
|
+
# the I18n.default_locale when a translation can not be found)
|
46
|
+
config.i18n.fallbacks = true
|
47
|
+
|
48
|
+
# Send deprecation notices to registered listeners
|
49
|
+
config.active_support.deprecation = :notify
|
50
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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
|
+
config.eager_load = false
|
10
|
+
|
11
|
+
# Show full error reports and disable caching
|
12
|
+
config.consider_all_requests_local = true
|
13
|
+
config.action_controller.perform_caching = false
|
14
|
+
|
15
|
+
# Raise exceptions instead of rendering exception templates
|
16
|
+
config.action_dispatch.show_exceptions = false
|
17
|
+
|
18
|
+
# Disable request forgery protection in test environment
|
19
|
+
config.action_controller.allow_forgery_protection = false
|
20
|
+
|
21
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
22
|
+
# The :test delivery method accumulates sent emails in the
|
23
|
+
# ActionMailer::Base.deliveries array.
|
24
|
+
config.action_mailer.delivery_method = :test
|
25
|
+
config.action_mailer.default_url_options = { :host => 'www.example.com' }
|
26
|
+
|
27
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
28
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
29
|
+
# like if you have constraints or database-specific column types
|
30
|
+
# config.active_record.schema_format = :sql
|
31
|
+
|
32
|
+
# Print deprecation notices to the stderr
|
33
|
+
config.active_support.deprecation = :stderr
|
34
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Janus.config do |config|
|
2
|
+
config.contact_email = "contact@some-example-domain.com"
|
3
|
+
|
4
|
+
# DatabaseAuthenticatable
|
5
|
+
config.authentication_keys = [:email]
|
6
|
+
config.encryptor = :bcrypt
|
7
|
+
config.stretches = 10
|
8
|
+
config.pepper = "db5ef161873f4b4cd966ff042c448282e8243a0a4e090347370360796ecc769f384d898badda1881bc7ed4483f20f6809b39a54f6671cc35cda18bfe554cd8e0"
|
9
|
+
# config.scrypt_options = { :max_time => 0.25 }
|
10
|
+
|
11
|
+
# Confirmable
|
12
|
+
# config.confirmation_key = :confirm_token
|
13
|
+
|
14
|
+
# Rememberable
|
15
|
+
# config.remember_for = 1.year
|
16
|
+
# config.extend_remember_period = false
|
17
|
+
|
18
|
+
# RemoteAuthenticatable
|
19
|
+
# config.remote_authentication_key = :auth_token
|
20
|
+
|
21
|
+
# TokenAuthenticatable
|
22
|
+
# config.token_authentication_key = :auth_token
|
23
|
+
# config.reusable_authentication_token = true
|
24
|
+
config.token_authentication_valid_for = 1.hour
|
25
|
+
end
|
@@ -0,0 +1,8 @@
|
|
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_key_base = 'c6a67697877c66be70cdcc4680f37593045a721cf757de4110f9749877cb32f94fe4ddaa5e816af4555d91c4f6142a401972474d50fe620d41ede300d3143d4a'
|
8
|
+
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,65 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
en:
|
5
|
+
# activerecord:
|
6
|
+
# attributes:
|
7
|
+
# user:
|
8
|
+
# email: "Email"
|
9
|
+
# password: "Password"
|
10
|
+
# password_confirmation: "Confirm password"
|
11
|
+
# current_password: "Current password"
|
12
|
+
# errors:
|
13
|
+
# messages:
|
14
|
+
# not_found: "not found"
|
15
|
+
|
16
|
+
flash:
|
17
|
+
janus:
|
18
|
+
passwords:
|
19
|
+
create:
|
20
|
+
email_sent: "Instructions to reset your password were sent to your email account."
|
21
|
+
user_not_found: "Error: no such user."
|
22
|
+
update:
|
23
|
+
password_updated: "Your password was successfully resetted."
|
24
|
+
invalid_token: "Error: invalid token."
|
25
|
+
|
26
|
+
janus:
|
27
|
+
mailer:
|
28
|
+
hello: "Hello,"
|
29
|
+
reset_password_instructions:
|
30
|
+
subject: "Instructions to change your password"
|
31
|
+
infos: "Somebody requested to change your password. To do so just click the following link:"
|
32
|
+
change_password_link: "Change my password"
|
33
|
+
please_ignore_your_password_wont_change: "If you didn't make this request, please delete this email immediately. Your password won't change until you click the link and change your password."
|
34
|
+
|
35
|
+
confirmation_instructions:
|
36
|
+
subject: "Confirm your account"
|
37
|
+
confirm: "You may confirm your registration by clicking the following link:"
|
38
|
+
confirm_my_account: "Confirm my account"
|
39
|
+
|
40
|
+
sessions:
|
41
|
+
new:
|
42
|
+
sign_in: "Sign in"
|
43
|
+
sign_in_btn: "Sign in"
|
44
|
+
|
45
|
+
registrations:
|
46
|
+
new:
|
47
|
+
sign_up: "Sign up"
|
48
|
+
sign_up_btn: "Sign up"
|
49
|
+
edit:
|
50
|
+
my_account: "My account"
|
51
|
+
save_changes_btn: "Save changes"
|
52
|
+
|
53
|
+
confirmations:
|
54
|
+
new:
|
55
|
+
resend_confirmation_instructions: "Resend confirmation instructions"
|
56
|
+
send_instructions_btn: "Send instructions"
|
57
|
+
|
58
|
+
passwords:
|
59
|
+
new:
|
60
|
+
forgot_password: "Forgot your password?"
|
61
|
+
send_instructions_btn: "Send instructions"
|
62
|
+
edit:
|
63
|
+
change_password: "Change your password"
|
64
|
+
change_password_btn: "Change my password"
|
65
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
RailsApp::Application.routes.draw do
|
2
|
+
janus :admins, :session => true
|
3
|
+
janus :users,
|
4
|
+
:session => true,
|
5
|
+
:registration => true,
|
6
|
+
:confirmation => true,
|
7
|
+
:password => true
|
8
|
+
|
9
|
+
resource :user, :only => :show
|
10
|
+
resource :blog, :only => :show
|
11
|
+
|
12
|
+
root :to => 'home#index'
|
13
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 :remember_token
|
8
|
+
t.datetime :remember_created_at
|
9
|
+
|
10
|
+
t.string :confirmation_token
|
11
|
+
t.datetime :confirmation_sent_at
|
12
|
+
t.datetime :confirmed_at
|
13
|
+
|
14
|
+
t.string :reset_password_token
|
15
|
+
t.datetime :reset_password_sent_at
|
16
|
+
|
17
|
+
t.string :session_token
|
18
|
+
|
19
|
+
t.string :authentication_token
|
20
|
+
t.datetime :authentication_token_created_at
|
21
|
+
|
22
|
+
t.integer :sign_in_count, :default => 0
|
23
|
+
t.string :last_sign_in_at
|
24
|
+
t.string :last_sign_in_ip
|
25
|
+
t.string :current_sign_in_at
|
26
|
+
t.string :current_sign_in_ip
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index :users, :email, :unique => true
|
30
|
+
add_index :users, :remember_token, :unique => true
|
31
|
+
add_index :users, :confirmation_token, :unique => true
|
32
|
+
add_index :users, :reset_password_token, :unique => true
|
33
|
+
add_index :users, :session_token, :unique => true
|
34
|
+
add_index :users, :authentication_token, :unique => true
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.down
|
38
|
+
drop_table :users
|
39
|
+
end
|
40
|
+
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,58 @@
|
|
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: 20130412104138) do
|
15
|
+
|
16
|
+
create_table "admins", force: true do |t|
|
17
|
+
t.string "email"
|
18
|
+
t.string "encrypted_password"
|
19
|
+
t.datetime "created_at"
|
20
|
+
t.datetime "updated_at"
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table "remote_tokens", force: true do |t|
|
24
|
+
t.integer "user_id"
|
25
|
+
t.string "token"
|
26
|
+
t.datetime "created_at"
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index "remote_tokens", ["token"], name: "index_remote_tokens_on_token", unique: true
|
30
|
+
|
31
|
+
create_table "users", force: true do |t|
|
32
|
+
t.string "email"
|
33
|
+
t.string "encrypted_password"
|
34
|
+
t.string "remember_token"
|
35
|
+
t.datetime "remember_created_at"
|
36
|
+
t.string "confirmation_token"
|
37
|
+
t.datetime "confirmation_sent_at"
|
38
|
+
t.datetime "confirmed_at"
|
39
|
+
t.string "reset_password_token"
|
40
|
+
t.datetime "reset_password_sent_at"
|
41
|
+
t.string "session_token"
|
42
|
+
t.string "authentication_token"
|
43
|
+
t.datetime "authentication_token_created_at"
|
44
|
+
t.integer "sign_in_count", default: 0
|
45
|
+
t.string "last_sign_in_at"
|
46
|
+
t.string "last_sign_in_ip"
|
47
|
+
t.string "current_sign_in_at"
|
48
|
+
t.string "current_sign_in_ip"
|
49
|
+
end
|
50
|
+
|
51
|
+
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true
|
52
|
+
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
53
|
+
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
54
|
+
add_index "users", ["remember_token"], name: "index_users_on_remember_token", unique: true
|
55
|
+
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
56
|
+
add_index "users", ["session_token"], name: "index_users_on_session_token", unique: true
|
57
|
+
|
58
|
+
end
|