1 # Use this hook to configure devise mailer, warden hooks and so forth. The first
2 # four configuration values can also be set straight in your models.
3 Devise.setup do |config|
4 # ==> Mailer Configuration
5 # Configure the e-mail address which will be shown in DeviseMailer.
6 config.mailer_sender = "please-change-me@config-initializers-devise.com"
8 # Configure the class responsible to send e-mails.
9 # config.mailer = "Devise::Mailer"
11 # ==> ORM configuration
12 # Load and configure the ORM. Supports :active_record (default) and
13 # :mongoid (bson_ext recommended) by default. Other ORMs may be
14 # available as additional gems.
15 require 'devise/orm/active_record'
17 # ==> Configuration for any authentication mechanism
18 # Configure which keys are used when authenticating an user. By default is
19 # just :email. You can configure it to use [:username, :subdomain], so for
20 # authenticating an user, both parameters are required. Remember that those
21 # parameters are used only when authenticating and not when retrieving from
22 # session. If you need permissions, you should implement that in a before filter.
23 # config.authentication_keys = [ :email ]
25 # Tell if authentication through request.params is enabled. True by default.
26 # config.params_authenticatable = true
28 # Tell if authentication through HTTP Basic Auth is enabled. True by default.
29 # config.http_authenticatable = true
31 # Set this to true to use Basic Auth for AJAX requests. True by default.
32 # config.http_authenticatable_on_xhr = true
34 # The realm used in Http Basic Authentication
35 # config.http_authentication_realm = "Application"
37 # ==> Configuration for :database_authenticatable
38 # For bcrypt, this is the cost for hashing the password and defaults to 10. If
39 # using other encryptors, it sets how many times you want the password re-encrypted.
42 # Define which will be the encryption algorithm. Devise also supports encryptors
43 # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
44 # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
45 # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
46 config.encryptor = :bcrypt
48 # Setup a pepper to generate the encrypted password.
49 config.pepper = "f60fe0491f40bc10f9b49a0fb1acd276295043f5221c7760f07db7f1b2aa52b1b3e4bc52be60a7f39fef71337f6fa7892a3891cb59e96d47303987e7e1f4acab"
51 # ==> Configuration for :confirmable
52 # The time you want to give your user to confirm his account. During this time
53 # he will be able to access your application without confirming. Default is nil.
54 # When confirm_within is zero, the user won't be able to sign in without confirming.
55 # You can use this to let your user access some features of your application
56 # without confirming the account, but blocking it after a certain period
58 # config.confirm_within = 2.days
60 # ==> Configuration for :rememberable
61 # The time the user will be remembered without asking for credentials again.
62 # config.remember_for = 2.weeks
64 # If true, a valid remember token can be re-used between multiple browsers.
65 # config.remember_across_browsers = true
67 # If true, extends the user's remember period when remembered via cookie.
68 # config.extend_remember_period = false
70 # ==> Configuration for :validatable
71 # Range for password length
72 # config.password_length = 6..20
74 # Regex to use to validate the email address
75 # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
77 # ==> Configuration for :timeoutable
78 # The time you want to timeout the user session without activity. After this
79 # time the user will be asked for credentials again.
80 # config.timeout_in = 10.minutes
82 # ==> Configuration for :lockable
83 # Defines which strategy will be used to lock an account.
84 # :failed_attempts = Locks an account after a number of failed attempts to sign in.
85 # :none = No lock strategy. You should handle locking by yourself.
86 # config.lock_strategy = :failed_attempts
88 # Defines which strategy will be used to unlock an account.
89 # :email = Sends an unlock link to the user email
90 # :time = Re-enables login after a certain amount of time (see :unlock_in below)
91 # :both = Enables both strategies
92 # :none = No unlock strategy. You should handle unlocking by yourself.
93 # config.unlock_strategy = :both
95 # Number of authentication tries before locking an account if lock_strategy
97 # config.maximum_attempts = 20
99 # Time interval to unlock the account if :time is enabled as unlock_strategy.
100 # config.unlock_in = 1.hour
102 # ==> Configuration for :token_authenticatable
103 # Defines name of the authentication token params key
104 # config.token_authentication_key = :auth_token
106 # ==> Scopes configuration
107 # Turn scoped views on. Before rendering "sessions/new", it will first check for
108 # "users/sessions/new". It's turned off by default because it's slower if you
109 # are using only default views.
110 # config.scoped_views = true
112 # Configure the default scope given to Warden. By default it's the first
113 # devise role declared in your routes.
114 # config.default_scope = :user
116 # Configure sign_out behavior.
117 # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
118 # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
119 # config.sign_out_all_scopes = false
121 # ==> Navigation configuration
122 # Lists the formats that should be treated as navigational. Formats like
123 # :html, should redirect to the sign in page when the user does not have
124 # access, but formats like :xml or :json, should return 401.
125 # If you have any extra navigational formats, like :iphone or :mobile, you
126 # should add them to the navigational formats lists. Default is [:html]
127 # config.navigational_formats = [:html, :iphone]
131 # ==> Warden configuration
132 # If you want to use other strategies, that are not (yet) supported by Devise,
133 # you can configure them inside the config.warden block. The example below
134 # allows you to setup OAuth, using http://github.com/roman/warden_oauth
136 # config.warden do |manager|
137 # manager.oauth(:twitter) do |twitter|
138 # twitter.consumer_secret = <YOUR CONSUMER SECRET>
139 # twitter.consumer_key = <YOUR CONSUMER KEY>
140 # twitter.options :site => 'http://twitter.com'
142 # manager.default_strategies(:scope => :user).unshift :twitter_oauth
146 Devise::SessionsController.ssl_required :new, :create