image_authentication 0.1.0 → 0.1.1
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.
- checksums.yaml +7 -0
- data/.gitignore +5 -1
- data/.travis.yml +14 -0
- data/Guardfile +24 -0
- data/README.md +8 -3
- data/Rakefile +8 -0
- data/image_authentication.gemspec +6 -1
- data/lib/image_authentication/controllers/helpers.rb +1 -1
- data/lib/image_authentication/hooks/image_authentication.rb +2 -2
- data/lib/image_authentication/models/image_authenticatable.rb +4 -6
- data/lib/image_authentication/version.rb +2 -2
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +14 -0
- data/spec/dummy/app/assets/stylesheets/application.css +14 -0
- data/spec/dummy/app/controllers/application_controller.rb +8 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/welcome_controller.rb +7 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/user.rb +8 -0
- data/spec/dummy/app/views/layouts/application.html.erb +5 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +21 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.travis.yml +17 -0
- data/spec/dummy/config/database.yml +14 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +244 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +57 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20140307132512_devise_create_users.rb +42 -0
- data/spec/dummy/db/migrate/20140307134300_image_authentication_add_to_users.rb +8 -0
- data/spec/dummy/db/schema.rb +39 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/log/development.log +21 -0
- data/spec/dummy/log/test.log +613 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/users.rb +7 -0
- data/spec/models/image_authenticable_spec.rb +101 -0
- data/spec/spec_helper.rb +14 -0
- metadata +203 -31
- data/.DS_Store +0 -0
- data/app/.DS_Store +0 -0
- data/app/assets/.DS_Store +0 -0
- data/app/assets/images/.DS_Store +0 -0
- data/app/assets/images/image_authentication/.DS_Store +0 -0
- data/app/assets/javascripts/.DS_Store +0 -0
- data/app/assets/stylesheets/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/generators/.DS_Store +0 -0
@@ -0,0 +1,244 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
|
+
# Many of these configuration options can be set straight in your model.
|
3
|
+
Devise.setup do |config|
|
4
|
+
config.secret_key = 'f5dbe52cd59567789d95cbdc922650cbfd28f17e66c431828dc6993b2aa1bec842150aca30bea1e409ce7a72e9147b8b871898bc9da1b550b7ac76db608831d1'
|
5
|
+
|
6
|
+
# ==> Mailer Configuration
|
7
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
8
|
+
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
9
|
+
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
10
|
+
|
11
|
+
# Configure the class responsible to send e-mails.
|
12
|
+
# config.mailer = "Devise::Mailer"
|
13
|
+
|
14
|
+
# ==> ORM configuration
|
15
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
16
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
17
|
+
# available as additional gems.
|
18
|
+
require 'devise/orm/active_record'
|
19
|
+
|
20
|
+
# ==> Configuration for any authentication mechanism
|
21
|
+
# Configure which keys are used when authenticating a user. The default is
|
22
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
23
|
+
# authenticating a user, both parameters are required. Remember that those
|
24
|
+
# parameters are used only when authenticating and not when retrieving from
|
25
|
+
# session. If you need permissions, you should implement that in a before filter.
|
26
|
+
# You can also supply a hash where the value is a boolean determining whether
|
27
|
+
# or not authentication should be aborted when the value is not present.
|
28
|
+
# config.authentication_keys = [ :email ]
|
29
|
+
|
30
|
+
# Configure parameters from the request object used for authentication. Each entry
|
31
|
+
# given should be a request method and it will automatically be passed to the
|
32
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
33
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
34
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
35
|
+
# config.request_keys = []
|
36
|
+
|
37
|
+
# Configure which authentication keys should be case-insensitive.
|
38
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
39
|
+
# to authenticate or find a user. Default is :email.
|
40
|
+
config.case_insensitive_keys = [ :email ]
|
41
|
+
|
42
|
+
# Configure which authentication keys should have whitespace stripped.
|
43
|
+
# These keys will have whitespace before and after removed upon creating or
|
44
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
45
|
+
config.strip_whitespace_keys = [ :email ]
|
46
|
+
|
47
|
+
# Tell if authentication through request.params is enabled. True by default.
|
48
|
+
# It can be set to an array that will enable params authentication only for the
|
49
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
50
|
+
# enable it only for database (email + password) authentication.
|
51
|
+
# config.params_authenticatable = true
|
52
|
+
|
53
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
54
|
+
# It can be set to an array that will enable http authentication only for the
|
55
|
+
# given strategies, for example, `config.http_authenticatable = [:token]` will
|
56
|
+
# enable it only for token authentication.
|
57
|
+
# config.http_authenticatable = false
|
58
|
+
|
59
|
+
# If http headers should be returned for AJAX requests. True by default.
|
60
|
+
# config.http_authenticatable_on_xhr = true
|
61
|
+
|
62
|
+
# The realm used in Http Basic Authentication. "Application" by default.
|
63
|
+
# config.http_authentication_realm = "Application"
|
64
|
+
|
65
|
+
# It will change confirmation, password recovery and other workflows
|
66
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
67
|
+
# Does not affect registerable.
|
68
|
+
# config.paranoid = true
|
69
|
+
|
70
|
+
# By default Devise will store the user in session. You can skip storage for
|
71
|
+
# :http_auth and :token_auth by adding those symbols to the array below.
|
72
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
73
|
+
# may want to disable generating routes to Devise's sessions controller by
|
74
|
+
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
75
|
+
config.skip_session_storage = [:http_auth]
|
76
|
+
|
77
|
+
# ==> Configuration for :database_authenticatable
|
78
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
79
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
80
|
+
#
|
81
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
82
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
83
|
+
# a value less than 10 in other environments.
|
84
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
85
|
+
|
86
|
+
# Setup a pepper to generate the encrypted password.
|
87
|
+
# config.pepper = "1cb210bef69b8a1db7cd4287b8ab6e2aaefc7d9d0d8ac292056416369ea384297e8545b78c4708fd8ff65b331cee7577c966afab4768accab39613f0933fe32a"
|
88
|
+
|
89
|
+
# ==> Configuration for :confirmable
|
90
|
+
# A period that the user is allowed to access the website even without
|
91
|
+
# confirming his account. For instance, if set to 2.days, the user will be
|
92
|
+
# able to access the website for two days without confirming his account,
|
93
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
94
|
+
# the user cannot access the website without confirming his account.
|
95
|
+
# config.allow_unconfirmed_access_for = 2.days
|
96
|
+
|
97
|
+
# A period that the user is allowed to confirm their account before their
|
98
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
99
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
100
|
+
# their account can't be confirmed with the token any more.
|
101
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
102
|
+
# before confirming their account.
|
103
|
+
# config.confirm_within = 3.days
|
104
|
+
|
105
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
106
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
107
|
+
# db field (see migrations). Until confirmed new email is stored in
|
108
|
+
# unconfirmed email column, and copied to email column on successful confirmation.
|
109
|
+
config.reconfirmable = true
|
110
|
+
|
111
|
+
# Defines which key will be used when confirming an account
|
112
|
+
# config.confirmation_keys = [ :email ]
|
113
|
+
|
114
|
+
# ==> Configuration for :rememberable
|
115
|
+
# The time the user will be remembered without asking for credentials again.
|
116
|
+
# config.remember_for = 2.weeks
|
117
|
+
|
118
|
+
# If true, extends the user's remember period when remembered via cookie.
|
119
|
+
# config.extend_remember_period = false
|
120
|
+
|
121
|
+
# Options to be passed to the created cookie. For instance, you can set
|
122
|
+
# :secure => true in order to force SSL only cookies.
|
123
|
+
# config.rememberable_options = {}
|
124
|
+
|
125
|
+
# ==> Configuration for :validatable
|
126
|
+
# Range for password length. Default is 8..128.
|
127
|
+
config.password_length = 6..128
|
128
|
+
|
129
|
+
# Email regex used to validate email formats. It simply asserts that
|
130
|
+
# one (and only one) @ exists in the given string. This is mainly
|
131
|
+
# to give user feedback and not to assert the e-mail validity.
|
132
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
133
|
+
|
134
|
+
# ==> Configuration for :timeoutable
|
135
|
+
# The time you want to timeout the user session without activity. After this
|
136
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
137
|
+
# config.timeout_in = 30.minutes
|
138
|
+
|
139
|
+
# If true, expires auth token on session timeout.
|
140
|
+
# config.expire_auth_token_on_timeout = false
|
141
|
+
|
142
|
+
# ==> Configuration for :lockable
|
143
|
+
# Defines which strategy will be used to lock an account.
|
144
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
145
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
146
|
+
# config.lock_strategy = :failed_attempts
|
147
|
+
|
148
|
+
# Defines which key will be used when locking and unlocking an account
|
149
|
+
# config.unlock_keys = [ :email ]
|
150
|
+
|
151
|
+
# Defines which strategy will be used to unlock an account.
|
152
|
+
# :email = Sends an unlock link to the user email
|
153
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
154
|
+
# :both = Enables both strategies
|
155
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
156
|
+
# config.unlock_strategy = :both
|
157
|
+
|
158
|
+
# Number of authentication tries before locking an account if lock_strategy
|
159
|
+
# is failed attempts.
|
160
|
+
# config.maximum_attempts = 20
|
161
|
+
|
162
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
163
|
+
# config.unlock_in = 1.hour
|
164
|
+
|
165
|
+
# ==> Configuration for :recoverable
|
166
|
+
#
|
167
|
+
# Defines which key will be used when recovering the password for an account
|
168
|
+
# config.reset_password_keys = [ :email ]
|
169
|
+
|
170
|
+
# Time interval you can reset your password with a reset password key.
|
171
|
+
# Don't put a too small interval or your users won't have the time to
|
172
|
+
# change their passwords.
|
173
|
+
config.reset_password_within = 6.hours
|
174
|
+
|
175
|
+
# ==> Configuration for :encryptable
|
176
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
177
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
178
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
179
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
180
|
+
# REST_AUTH_SITE_KEY to pepper).
|
181
|
+
#
|
182
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
183
|
+
# config.encryptor = :sha512
|
184
|
+
|
185
|
+
# ==> Configuration for :token_authenticatable
|
186
|
+
# Defines name of the authentication token params key
|
187
|
+
# config.token_authentication_key = :auth_token
|
188
|
+
|
189
|
+
# ==> Scopes configuration
|
190
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
191
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
192
|
+
# are using only default views.
|
193
|
+
# config.scoped_views = false
|
194
|
+
|
195
|
+
# Configure the default scope given to Warden. By default it's the first
|
196
|
+
# devise role declared in your routes (usually :user).
|
197
|
+
# config.default_scope = :user
|
198
|
+
|
199
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
200
|
+
# only the current scope. By default, Devise signs out all scopes.
|
201
|
+
# config.sign_out_all_scopes = true
|
202
|
+
|
203
|
+
# ==> Navigation configuration
|
204
|
+
# Lists the formats that should be treated as navigational. Formats like
|
205
|
+
# :html, should redirect to the sign in page when the user does not have
|
206
|
+
# access, but formats like :xml or :json, should return 401.
|
207
|
+
#
|
208
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
209
|
+
# should add them to the navigational formats lists.
|
210
|
+
#
|
211
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
212
|
+
# config.navigational_formats = ["*/*", :html]
|
213
|
+
|
214
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
215
|
+
config.sign_out_via = :get
|
216
|
+
|
217
|
+
# ==> OmniAuth
|
218
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
219
|
+
# up on your models and hooks.
|
220
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
221
|
+
|
222
|
+
# ==> Warden configuration
|
223
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
224
|
+
# change the failure app, you can configure them inside the config.warden block.
|
225
|
+
#
|
226
|
+
# config.warden do |manager|
|
227
|
+
# # manager.intercept_401 = false
|
228
|
+
# manager.default_strategies(:scope => :user).unshift :admin_authenticatable
|
229
|
+
# end
|
230
|
+
|
231
|
+
# ==> Mountable engine configurations
|
232
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
233
|
+
# is mountable, there are some extra configurations to be taken into account.
|
234
|
+
# The following options are available, assuming the engine is mounted as:
|
235
|
+
#
|
236
|
+
# mount MyEngine, at: "/my_engine"
|
237
|
+
#
|
238
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
239
|
+
# config.router_name = :my_engine
|
240
|
+
#
|
241
|
+
# When using omniauth, Devise cannot automatically set Omniauth path,
|
242
|
+
# so you need to do it manually. For the users scope, it would be:
|
243
|
+
# config.omniauth_path_prefix = "/my_engine/users/auth"
|
244
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = '62ff4f9ac7da32c856b70068dd41b3f3e33f9bb6e68096170425f8d10bab82aeba5f0d96c2d5c26830a6981c7d56849cd8a00d77a33ac4cbd511c76058ed3968'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -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,57 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
devise_for :users
|
3
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
4
|
+
# See how all your routes lay out with "rake routes".
|
5
|
+
|
6
|
+
# You can have the root of your site routed with "root"
|
7
|
+
root 'welcome#index'
|
8
|
+
|
9
|
+
# Example of regular route:
|
10
|
+
# get 'products/:id' => 'catalog#view'
|
11
|
+
|
12
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
13
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
14
|
+
|
15
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
16
|
+
# resources :products
|
17
|
+
|
18
|
+
# Example resource route with options:
|
19
|
+
# resources :products do
|
20
|
+
# member do
|
21
|
+
# get 'short'
|
22
|
+
# post 'toggle'
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# collection do
|
26
|
+
# get 'sold'
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
|
30
|
+
# Example resource route with sub-resources:
|
31
|
+
# resources :products do
|
32
|
+
# resources :comments, :sales
|
33
|
+
# resource :seller
|
34
|
+
# end
|
35
|
+
|
36
|
+
# Example resource route with more complex sub-resources:
|
37
|
+
# resources :products do
|
38
|
+
# resources :comments
|
39
|
+
# resources :sales do
|
40
|
+
# get 'recent', on: :collection
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
|
44
|
+
# Example resource route with concerns:
|
45
|
+
# concern :toggleable do
|
46
|
+
# post 'toggle'
|
47
|
+
# end
|
48
|
+
# resources :posts, concerns: :toggleable
|
49
|
+
# resources :photos, concerns: :toggleable
|
50
|
+
|
51
|
+
# Example resource route within a namespace:
|
52
|
+
# namespace :admin do
|
53
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
54
|
+
# # (app/controllers/admin/products_controller.rb)
|
55
|
+
# resources :products
|
56
|
+
# end
|
57
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class DeviseCreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_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
|
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
|
+
t.integer :failed_attempts, :default => 0
|
23
|
+
t.string :unlock_token
|
24
|
+
t.datetime :locked_at
|
25
|
+
|
26
|
+
# t.confirmable
|
27
|
+
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
|
28
|
+
# t.token_authenticatable
|
29
|
+
|
30
|
+
t.timestamps
|
31
|
+
end
|
32
|
+
|
33
|
+
add_index :users, :email, :unique => true
|
34
|
+
add_index :users, :reset_password_token, :unique => true
|
35
|
+
# add_index :users, :confirmation_token, :unique => true
|
36
|
+
# add_index :users, :unlock_token, :unique => true
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.down
|
40
|
+
drop_table :users
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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: 20140307134300) do
|
15
|
+
|
16
|
+
create_table "users", force: true do |t|
|
17
|
+
t.string "email", default: "", null: false
|
18
|
+
t.string "encrypted_password", default: "", null: false
|
19
|
+
t.string "reset_password_token"
|
20
|
+
t.datetime "reset_password_sent_at"
|
21
|
+
t.datetime "remember_created_at"
|
22
|
+
t.integer "sign_in_count", default: 0
|
23
|
+
t.datetime "current_sign_in_at"
|
24
|
+
t.datetime "last_sign_in_at"
|
25
|
+
t.string "current_sign_in_ip"
|
26
|
+
t.string "last_sign_in_ip"
|
27
|
+
t.integer "failed_attempts", default: 0
|
28
|
+
t.string "unlock_token"
|
29
|
+
t.datetime "locked_at"
|
30
|
+
t.datetime "created_at"
|
31
|
+
t.datetime "updated_at"
|
32
|
+
t.boolean "image_authentication_enabled", default: false
|
33
|
+
t.integer "auth_categories_mask", default: 0
|
34
|
+
end
|
35
|
+
|
36
|
+
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
37
|
+
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
38
|
+
|
39
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
[1m[36m (6.6ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
|
+
[1m[35m (0.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
+
Migrating to CreateDeviseUsers (20140307132512)
|
5
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
6
|
+
Migrating to DeviseCreateUsers (20140307132512)
|
7
|
+
[1m[35m (0.1ms)[0m begin transaction
|
8
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "failed_attempts" integer DEFAULT 0, "unlock_token" varchar(255), "locked_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
9
|
+
[1m[35m (0.4ms)[0m CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
|
10
|
+
[1m[36m (0.2ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
11
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140307132512"]]
|
12
|
+
[1m[36m (4.2ms)[0m [1mcommit transaction[0m
|
13
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
14
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
15
|
+
Migrating to ImageAuthenticationAddToUsers (20140307134300)
|
16
|
+
[1m[35m (0.1ms)[0m begin transaction
|
17
|
+
[1m[36m (0.6ms)[0m [1mALTER TABLE "users" ADD "image_authentication_enabled" boolean DEFAULT 'f'[0m
|
18
|
+
[1m[35m (0.3ms)[0m ALTER TABLE "users" ADD "auth_categories_mask" integer DEFAULT 0
|
19
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140307134300"]]
|
20
|
+
[1m[35m (0.8ms)[0m commit transaction
|
21
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|