OSDN Git Service

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