You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

313 lines
15 KiB

  1. # frozen_string_literal: true
  2. # Assuming you have not yet modified this file, each configuration option below
  3. # is set to its default value. Note that some are commented out while others
  4. # are not: uncommented lines are intended to protect your configuration from
  5. # breaking changes in upgrades (i.e., in the event that future versions of
  6. # Devise change the default values for those options).
  7. #
  8. # Use this hook to configure devise mailer, warden hooks and so forth.
  9. # Many of these configuration options can be set straight in your model.
  10. Devise.setup do |config|
  11. # The secret key used by Devise. Devise uses this key to generate
  12. # random tokens. Changing this key will render invalid all existing
  13. # confirmation, reset password and unlock tokens in the database.
  14. # Devise will use the `secret_key_base` as its `secret_key`
  15. # by default. You can change it below and use your own secret key.
  16. # config.secret_key = '11ba8e8160aa9c5cb3fe67db99cbf9aef709e0ee315609374961d75067cbfe541725730ff9e5c63a159e93b6f6e03152505c6ce42ae431aaac363db9f245eaaf'
  17. # ==> Controller configuration
  18. # Configure the parent class to the devise controllers.
  19. # config.parent_controller = 'DeviseController'
  20. # ==> Mailer Configuration
  21. # Configure the e-mail address which will be shown in Devise::Mailer,
  22. # note that it will be overwritten if you use your own mailer class
  23. # with default "from" parameter.
  24. config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
  25. # Configure the class responsible to send e-mails.
  26. # config.mailer = 'Devise::Mailer'
  27. # Configure the parent class responsible to send e-mails.
  28. # config.parent_mailer = 'ActionMailer::Base'
  29. # ==> ORM configuration
  30. # Load and configure the ORM. Supports :active_record (default) and
  31. # :mongoid (bson_ext recommended) by default. Other ORMs may be
  32. # available as additional gems.
  33. require 'devise/orm/active_record'
  34. # ==> Configuration for any authentication mechanism
  35. # Configure which keys are used when authenticating a user. The default is
  36. # just :email. You can configure it to use [:username, :subdomain], so for
  37. # authenticating a user, both parameters are required. Remember that those
  38. # parameters are used only when authenticating and not when retrieving from
  39. # session. If you need permissions, you should implement that in a before filter.
  40. # You can also supply a hash where the value is a boolean determining whether
  41. # or not authentication should be aborted when the value is not present.
  42. # config.authentication_keys = [:email]
  43. # Configure parameters from the request object used for authentication. Each entry
  44. # given should be a request method and it will automatically be passed to the
  45. # find_for_authentication method and considered in your model lookup. For instance,
  46. # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
  47. # The same considerations mentioned for authentication_keys also apply to request_keys.
  48. # config.request_keys = []
  49. # Configure which authentication keys should be case-insensitive.
  50. # These keys will be downcased upon creating or modifying a user and when used
  51. # to authenticate or find a user. Default is :email.
  52. config.case_insensitive_keys = [:email]
  53. # Configure which authentication keys should have whitespace stripped.
  54. # These keys will have whitespace before and after removed upon creating or
  55. # modifying a user and when used to authenticate or find a user. Default is :email.
  56. config.strip_whitespace_keys = [:email]
  57. # Tell if authentication through request.params is enabled. True by default.
  58. # It can be set to an array that will enable params authentication only for the
  59. # given strategies, for example, `config.params_authenticatable = [:database]` will
  60. # enable it only for database (email + password) authentication.
  61. # config.params_authenticatable = true
  62. # Tell if authentication through HTTP Auth is enabled. False by default.
  63. # It can be set to an array that will enable http authentication only for the
  64. # given strategies, for example, `config.http_authenticatable = [:database]` will
  65. # enable it only for database authentication.
  66. # For API-only applications to support authentication "out-of-the-box", you will likely want to
  67. # enable this with :database unless you are using a custom strategy.
  68. # The supported strategies are:
  69. # :database = Support basic authentication with authentication key + password
  70. # config.http_authenticatable = false
  71. # If 401 status code should be returned for AJAX requests. True by default.
  72. # config.http_authenticatable_on_xhr = true
  73. # The realm used in Http Basic Authentication. 'Application' by default.
  74. # config.http_authentication_realm = 'Application'
  75. # It will change confirmation, password recovery and other workflows
  76. # to behave the same regardless if the e-mail provided was right or wrong.
  77. # Does not affect registerable.
  78. # config.paranoid = true
  79. # By default Devise will store the user in session. You can skip storage for
  80. # particular strategies by setting this option.
  81. # Notice that if you are skipping storage for all authentication paths, you
  82. # may want to disable generating routes to Devise's sessions controller by
  83. # passing skip: :sessions to `devise_for` in your config/routes.rb
  84. config.skip_session_storage = [:http_auth]
  85. # By default, Devise cleans up the CSRF token on authentication to
  86. # avoid CSRF token fixation attacks. This means that, when using AJAX
  87. # requests for sign in and sign up, you need to get a new CSRF token
  88. # from the server. You can disable this option at your own risk.
  89. # config.clean_up_csrf_token_on_authentication = true
  90. # When false, Devise will not attempt to reload routes on eager load.
  91. # This can reduce the time taken to boot the app but if your application
  92. # requires the Devise mappings to be loaded during boot time the application
  93. # won't boot properly.
  94. # config.reload_routes = true
  95. # ==> Configuration for :database_authenticatable
  96. # For bcrypt, this is the cost for hashing the password and defaults to 12. If
  97. # using other algorithms, it sets how many times you want the password to be hashed.
  98. # The number of stretches used for generating the hashed password are stored
  99. # with the hashed password. This allows you to change the stretches without
  100. # invalidating existing passwords.
  101. #
  102. # Limiting the stretches to just one in testing will increase the performance of
  103. # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
  104. # a value less than 10 in other environments. Note that, for bcrypt (the default
  105. # algorithm), the cost increases exponentially with the number of stretches (e.g.
  106. # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
  107. config.stretches = Rails.env.test? ? 1 : 12
  108. # Set up a pepper to generate the hashed password.
  109. # config.pepper = 'eaf54f8f539056cf47791a5f6864182cc8f6443bf251c43cf9c54c61de88cf47a4790bf25b673f47407f4b9cf429ce4f17eaf9b73c7089177886463c34f9539a'
  110. # Send a notification to the original email when the user's email is changed.
  111. # config.send_email_changed_notification = false
  112. # Send a notification email when the user's password is changed.
  113. # config.send_password_change_notification = false
  114. # ==> Configuration for :confirmable
  115. # A period that the user is allowed to access the website even without
  116. # confirming their account. For instance, if set to 2.days, the user will be
  117. # able to access the website for two days without confirming their account,
  118. # access will be blocked just in the third day.
  119. # You can also set it to nil, which will allow the user to access the website
  120. # without confirming their account.
  121. # Default is 0.days, meaning the user cannot access the website without
  122. # confirming their account.
  123. # config.allow_unconfirmed_access_for = 2.days
  124. # A period that the user is allowed to confirm their account before their
  125. # token becomes invalid. For example, if set to 3.days, the user can confirm
  126. # their account within 3 days after the mail was sent, but on the fourth day
  127. # their account can't be confirmed with the token any more.
  128. # Default is nil, meaning there is no restriction on how long a user can take
  129. # before confirming their account.
  130. # config.confirm_within = 3.days
  131. # If true, requires any email changes to be confirmed (exactly the same way as
  132. # initial account confirmation) to be applied. Requires additional unconfirmed_email
  133. # db field (see migrations). Until confirmed, new email is stored in
  134. # unconfirmed_email column, and copied to email column on successful confirmation.
  135. config.reconfirmable = true
  136. # Defines which key will be used when confirming an account
  137. # config.confirmation_keys = [:email]
  138. # ==> Configuration for :rememberable
  139. # The time the user will be remembered without asking for credentials again.
  140. # config.remember_for = 2.weeks
  141. # Invalidates all the remember me tokens when the user signs out.
  142. config.expire_all_remember_me_on_sign_out = true
  143. # If true, extends the user's remember period when remembered via cookie.
  144. # config.extend_remember_period = false
  145. # Options to be passed to the created cookie. For instance, you can set
  146. # secure: true in order to force SSL only cookies.
  147. # config.rememberable_options = {}
  148. # ==> Configuration for :validatable
  149. # Range for password length.
  150. config.password_length = 6..128
  151. # Email regex used to validate email formats. It simply asserts that
  152. # one (and only one) @ exists in the given string. This is mainly
  153. # to give user feedback and not to assert the e-mail validity.
  154. config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
  155. # ==> Configuration for :timeoutable
  156. # The time you want to timeout the user session without activity. After this
  157. # time the user will be asked for credentials again. Default is 30 minutes.
  158. # config.timeout_in = 30.minutes
  159. # ==> Configuration for :lockable
  160. # Defines which strategy will be used to lock an account.
  161. # :failed_attempts = Locks an account after a number of failed attempts to sign in.
  162. # :none = No lock strategy. You should handle locking by yourself.
  163. # config.lock_strategy = :failed_attempts
  164. # Defines which key will be used when locking and unlocking an account
  165. # config.unlock_keys = [:email]
  166. # Defines which strategy will be used to unlock an account.
  167. # :email = Sends an unlock link to the user email
  168. # :time = Re-enables login after a certain amount of time (see :unlock_in below)
  169. # :both = Enables both strategies
  170. # :none = No unlock strategy. You should handle unlocking by yourself.
  171. # config.unlock_strategy = :both
  172. # Number of authentication tries before locking an account if lock_strategy
  173. # is failed attempts.
  174. # config.maximum_attempts = 20
  175. # Time interval to unlock the account if :time is enabled as unlock_strategy.
  176. # config.unlock_in = 1.hour
  177. # Warn on the last attempt before the account is locked.
  178. # config.last_attempt_warning = true
  179. # ==> Configuration for :recoverable
  180. #
  181. # Defines which key will be used when recovering the password for an account
  182. # config.reset_password_keys = [:email]
  183. # Time interval you can reset your password with a reset password key.
  184. # Don't put a too small interval or your users won't have the time to
  185. # change their passwords.
  186. config.reset_password_within = 6.hours
  187. # When set to false, does not sign a user in automatically after their password is
  188. # reset. Defaults to true, so a user is signed in automatically after a reset.
  189. # config.sign_in_after_reset_password = true
  190. # ==> Configuration for :encryptable
  191. # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
  192. # You can use :sha1, :sha512 or algorithms from others authentication tools as
  193. # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
  194. # for default behavior) and :restful_authentication_sha1 (then you should set
  195. # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
  196. #
  197. # Require the `devise-encryptable` gem when using anything other than bcrypt
  198. # config.encryptor = :sha512
  199. # ==> Scopes configuration
  200. # Turn scoped views on. Before rendering "sessions/new", it will first check for
  201. # "users/sessions/new". It's turned off by default because it's slower if you
  202. # are using only default views.
  203. # config.scoped_views = false
  204. # Configure the default scope given to Warden. By default it's the first
  205. # devise role declared in your routes (usually :user).
  206. # config.default_scope = :user
  207. # Set this configuration to false if you want /users/sign_out to sign out
  208. # only the current scope. By default, Devise signs out all scopes.
  209. # config.sign_out_all_scopes = true
  210. # ==> Navigation configuration
  211. # Lists the formats that should be treated as navigational. Formats like
  212. # :html should redirect to the sign in page when the user does not have
  213. # access, but formats like :xml or :json, should return 401.
  214. #
  215. # If you have any extra navigational formats, like :iphone or :mobile, you
  216. # should add them to the navigational formats lists.
  217. #
  218. # The "*/*" below is required to match Internet Explorer requests.
  219. # config.navigational_formats = ['*/*', :html, :turbo_stream]
  220. # The default HTTP method used to sign out a resource. Default is :delete.
  221. config.sign_out_via = :delete
  222. # ==> OmniAuth
  223. # Add a new OmniAuth provider. Check the wiki for more information on setting
  224. # up on your models and hooks.
  225. # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
  226. # ==> Warden configuration
  227. # If you want to use other strategies, that are not supported by Devise, or
  228. # change the failure app, you can configure them inside the config.warden block.
  229. #
  230. # config.warden do |manager|
  231. # manager.intercept_401 = false
  232. # manager.default_strategies(scope: :user).unshift :some_external_strategy
  233. # end
  234. # ==> Mountable engine configurations
  235. # When using Devise inside an engine, let's call it `MyEngine`, and this engine
  236. # is mountable, there are some extra configurations to be taken into account.
  237. # The following options are available, assuming the engine is mounted as:
  238. #
  239. # mount MyEngine, at: '/my_engine'
  240. #
  241. # The router that invoked `devise_for`, in the example above, would be:
  242. # config.router_name = :my_engine
  243. #
  244. # When using OmniAuth, Devise cannot automatically set OmniAuth path,
  245. # so you need to do it manually. For the users scope, it would be:
  246. # config.omniauth_path_prefix = '/my_engine/users/auth'
  247. # ==> Hotwire/Turbo configuration
  248. # When using Devise with Hotwire/Turbo, the http status for error responses
  249. # and some redirects must match the following. The default in Devise for existing
  250. # apps is `200 OK` and `302 Found respectively`, but new apps are generated with
  251. # these new defaults that match Hotwire/Turbo behavior.
  252. # Note: These might become the new default in future versions of Devise.
  253. config.responder.error_status = :unprocessable_entity
  254. config.responder.redirect_status = :see_other
  255. # ==> Configuration for :registerable
  256. # When set to false, does not sign a user in automatically after their password is
  257. # changed. Defaults to true, so a user is signed in automatically after changing a password.
  258. # config.sign_in_after_change_password = true
  259. end