OSDN Git Service

d64c9044f4cdf7812736f3e3f0936dd24034d29a
[pettanr/pettanr.git] / config / initializers / devise.rb
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   # ==> Mailer Configuration
5   # Configure the e-mail address which will be shown in Devise::Mailer,
6   # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7   config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
8 config.sign_out_via = :get
9   config.omniauth :twitter, Rails.application.secrets.twitter_api_key, Rails.application.secrets.twitter_api_secret
10   config.secret_key = Rails.application.secrets.devise_secret
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   # config.params_authenticatable = true
49
50   # Tell if authentication through HTTP Basic Auth is enabled. False by default.
51   # config.http_authenticatable = false
52
53   # If http headers should be returned for AJAX requests. True by default.
54  config.http_authenticatable_on_xhr = true
55
56   # The realm used in Http Basic Authentication. "Application" by default.
57   # config.http_authentication_realm = "Application"
58
59   # It will change confirmation, password recovery and other workflows
60   # to behave the same regardless if the e-mail provided was right or wrong.
61   # Does not affect registerable.
62   # config.paranoid = true
63
64   # ==> Configuration for :database_authenticatable
65   # For bcrypt, this is the cost for hashing the password and defaults to 10. If
66   # using other encryptors, it sets how many times you want the password re-encrypted.
67   #
68   # Limiting the stretches to just one in testing will increase the performance of
69   # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
70   # a value less than 10 in other environments.
71   config.stretches = Rails.env.test? ? 1 : 10
72
73   # Setup a pepper to generate the encrypted password.
74   # config.pepper = "7835fc9cebff957984851fd2936fbfb6593439b1ebf26dbe6e3da1554a12dfaaa6e551ad7b4681d07ccaf66cd73cf9440cd54c75e0d85caa27f605118b1456b0"
75
76   # ==> Configuration for :confirmable
77   # A period that the user is allowed to access the website even without
78   # confirming his account. For instance, if set to 2.days, the user will be
79   # able to access the website for two days without confirming his account,
80   # access will be blocked just in the third day. Default is 0.days, meaning
81   # the user cannot access the website without confirming his account.
82   # config.confirm_within = 2.days
83
84   # Defines which key will be used when confirming an account
85   # config.confirmation_keys = [ :email ]
86
87   # ==> Configuration for :rememberable
88   # The time the user will be remembered without asking for credentials again.
89   # config.remember_for = 2.weeks
90
91   # If true, a valid remember token can be re-used between multiple browsers.
92   # config.remember_across_browsers = true
93
94   # If true, extends the user's remember period when remembered via cookie.
95   # config.extend_remember_period = false
96
97   # If true, uses the password salt as remember token. This should be turned
98   # to false if you are not using database authenticatable.
99   # config.use_salt_as_remember_token = true
100
101   # Options to be passed to the created cookie. For instance, you can set
102   # :secure => true in order to force SSL only cookies.
103   # config.cookie_options = {}
104
105   # ==> Configuration for :validatable
106   # Range for password length. Default is 6..128.
107   # config.password_length = 6..128
108
109   # Email regex used to validate email formats. It simply asserts that
110   # an one (and only one) @ exists in the given string. This is mainly
111   # to give user feedback and not to assert the e-mail validity.
112   # config.email_regexp = /\A[^@]+@[^@]+\z/
113
114   # ==> Configuration for :timeoutable
115   # The time you want to timeout the user session without activity. After this
116   # time the user will be asked for credentials again. Default is 30 minutes.
117   # config.timeout_in = 30.minutes
118
119   # ==> Configuration for :lockable
120   # Defines which strategy will be used to lock an account.
121   # :failed_attempts = Locks an account after a number of failed attempts to sign in.
122   # :none            = No lock strategy. You should handle locking by yourself.
123   # config.lock_strategy = :failed_attempts
124
125   # Defines which key will be used when locking and unlocking an account
126   # config.unlock_keys = [ :email ]
127
128   # Defines which strategy will be used to unlock an account.
129   # :email = Sends an unlock link to the user email
130   # :time  = Re-enables login after a certain amount of time (see :unlock_in below)
131   # :both  = Enables both strategies
132   # :none  = No unlock strategy. You should handle unlocking by yourself.
133   # config.unlock_strategy = :both
134
135   # Number of authentication tries before locking an account if lock_strategy
136   # is failed attempts.
137   # config.maximum_attempts = 20
138
139   # Time interval to unlock the account if :time is enabled as unlock_strategy.
140   # config.unlock_in = 1.hour
141
142   # ==> Configuration for :recoverable
143   #
144   # Defines which key will be used when recovering the password for an account
145   # config.reset_password_keys = [ :email ]
146
147   # Time interval you can reset your password with a reset password key.
148   # Don't put a too small interval or your users won't have the time to
149   # change their passwords.
150   config.reset_password_within = 2.hours
151
152   # ==> Configuration for :encryptable
153   # Allow you to use another encryption algorithm besides bcrypt (default). You can use
154   # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
155   # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
156   # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
157   # REST_AUTH_SITE_KEY to pepper)
158   # config.encryptor = :sha512
159
160   # ==> Configuration for :token_authenticatable
161   # Defines name of the authentication token params key
162 # config.token_authentication_key = :auth_token
163
164   # If true, authentication through token does not store user in session and needs
165   # to be supplied on each request. Useful if you are using the token as API token.
166   # config.stateless_token = false
167
168   # ==> Scopes configuration
169   # Turn scoped views on. Before rendering "sessions/new", it will first check for
170   # "users/sessions/new". It's turned off by default because it's slower if you
171   # are using only default views.
172 config.scoped_views = true
173
174   # Configure the default scope given to Warden. By default it's the first
175   # devise role declared in your routes (usually :user).
176   # config.default_scope = :user
177
178   # Configure sign_out behavior.
179   # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
180   # The default is true, which means any logout action will sign out all active scopes.
181   # config.sign_out_all_scopes = true
182
183   # ==> Navigation configuration
184   # Lists the formats that should be treated as navigational. Formats like
185   # :html, should redirect to the sign in page when the user does not have
186   # access, but formats like :xml or :json, should return 401.
187   #
188   # If you have any extra navigational formats, like :iphone or :mobile, you
189   # should add them to the navigational formats lists.
190   #
191   # The :"*/*" and "*/*" formats below is required to match Internet
192   # Explorer requests.
193  config.navigational_formats = [:"*/*", "*/*", :html, :json]
194
195   # The default HTTP method used to sign out a resource. Default is :delete.
196   config.sign_out_via = :delete
197
198   # ==> OmniAuth
199   # Add a new OmniAuth provider. Check the wiki for more information on setting
200   # up on your models and hooks.
201   # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
202
203   # ==> Warden configuration
204   # If you want to use other strategies, that are not supported by Devise, or
205   # change the failure app, you can configure them inside the config.warden block.
206   #
207   # config.warden do |manager|
208   #   manager.intercept_401 = false
209   #   manager.default_strategies(:scope => :user).unshift :some_external_strategy
210   # end
211 end