PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/test/rails_app/config/initializers/devise.rb

https://gitlab.com/pymevirtual/devise
Ruby | 180 lines | 18 code | 37 blank | 125 comment | 0 complexity | d92a031208d20d707d39f06ce17a0a61 MD5 | raw file
  1. require "omniauth-facebook"
  2. require "omniauth-openid"
  3. # Use this hook to configure devise mailer, warden hooks and so forth. The first
  4. # four configuration values can also be set straight in your models.
  5. Devise.setup do |config|
  6. config.secret_key = "d9eb5171c59a4c817f68b0de27b8c1e340c2341b52cdbc60d3083d4e8958532" \
  7. "18dcc5f589cafde048faec956b61f864b9b5513ff9ce29bf9e5d58b0f234f8e3b"
  8. # ==> Mailer Configuration
  9. # Configure the e-mail address which will be shown in Devise::Mailer,
  10. # note that it will be overwritten if you use your own mailer class with default "from" parameter.
  11. config.mailer_sender = "please-change-me@config-initializers-devise.com"
  12. config.parent_controller = "ApplicationWithFakeEngine"
  13. # Configure the class responsible to send e-mails.
  14. # config.mailer = "Devise::Mailer"
  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/#{DEVISE_ORM}"
  20. # ==> Configuration for any authentication mechanism
  21. # Configure which keys are used when authenticating a user. By 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 hash where the value is a boolean expliciting if authentication
  27. # should be aborted or not if the value is not present. By default is empty.
  28. # config.authentication_keys = [:email]
  29. # Configure parameters from the request object used for authentication. Each entry
  30. # given should be a request method and it will automatically be passed to
  31. # find_for_authentication method and considered in your model lookup. For instance,
  32. # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
  33. # The same considerations mentioned for authentication_keys also apply to request_keys.
  34. # config.request_keys = []
  35. # Configure which authentication keys should be case-insensitive.
  36. # These keys will be downcased upon creating or modifying a user and when used
  37. # to authenticate or find a user. Default is :email.
  38. config.case_insensitive_keys = [:email]
  39. # Configure which authentication keys should have whitespace stripped.
  40. # These keys will have whitespace before and after removed upon creating or
  41. # modifying a user and when used to authenticate or find a user. Default is :email.
  42. config.strip_whitespace_keys = [:email]
  43. # Tell if authentication through request.params is enabled. True by default.
  44. # config.params_authenticatable = true
  45. # Tell if authentication through HTTP Basic Auth is enabled. False by default.
  46. config.http_authenticatable = true
  47. # If http headers should be returned for AJAX requests. True by default.
  48. # config.http_authenticatable_on_xhr = true
  49. # The realm used in Http Basic Authentication. "Application" by default.
  50. # config.http_authentication_realm = "Application"
  51. # ==> Configuration for :database_authenticatable
  52. # For bcrypt, this is the cost for hashing the password and defaults to 10. If
  53. # using other encryptors, it sets how many times you want the password re-encrypted.
  54. config.stretches = Rails.env.test? ? 1 : 10
  55. # ==> Configuration for :confirmable
  56. # The time you want to give your user to confirm their account. During this time
  57. # they will be able to access your application without confirming. Default is nil.
  58. # When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
  59. # You can use this to let your user access some features of your application
  60. # without confirming the account, but blocking it after a certain period
  61. # (ie 2 days).
  62. # config.allow_unconfirmed_access_for = 2.days
  63. # Defines which key will be used when confirming an account
  64. # config.confirmation_keys = [:email]
  65. # ==> Configuration for :rememberable
  66. # The time the user will be remembered without asking for credentials again.
  67. # config.remember_for = 2.weeks
  68. # If true, extends the user's remember period when remembered via cookie.
  69. # config.extend_remember_period = false
  70. # ==> Configuration for :validatable
  71. # Range for password length. Default is 8..72.
  72. # config.password_length = 8..72
  73. # Regex to use to validate the email address
  74. # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
  75. # ==> Configuration for :timeoutable
  76. # The time you want to timeout the user session without activity. After this
  77. # time the user will be asked for credentials again. Default is 30 minutes.
  78. # config.timeout_in = 30.minutes
  79. # ==> Configuration for :lockable
  80. # Defines which strategy will be used to lock an account.
  81. # :failed_attempts = Locks an account after a number of failed attempts to sign in.
  82. # :none = No lock strategy. You should handle locking by yourself.
  83. # config.lock_strategy = :failed_attempts
  84. # Defines which key will be used when locking and unlocking an account
  85. # config.unlock_keys = [:email]
  86. # Defines which strategy will be used to unlock an account.
  87. # :email = Sends an unlock link to the user email
  88. # :time = Re-enables login after a certain amount of time (see :unlock_in below)
  89. # :both = Enables both strategies
  90. # :none = No unlock strategy. You should handle unlocking by yourself.
  91. # config.unlock_strategy = :both
  92. # Number of authentication tries before locking an account if lock_strategy
  93. # is failed attempts.
  94. # config.maximum_attempts = 20
  95. # Time interval to unlock the account if :time is enabled as unlock_strategy.
  96. # config.unlock_in = 1.hour
  97. # ==> Configuration for :recoverable
  98. #
  99. # Defines which key will be used when recovering the password for an account
  100. # config.reset_password_keys = [:email]
  101. # Time interval you can reset your password with a reset password key.
  102. # Don't put a too small interval or your users won't have the time to
  103. # change their passwords.
  104. config.reset_password_within = 2.hours
  105. # When set to false, does not sign a user in automatically after their password is
  106. # reset. Defaults to true, so a user is signed in automatically after a reset.
  107. # config.sign_in_after_reset_password = true
  108. # Set up a pepper to generate the encrypted password.
  109. config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
  110. # ==> Scopes configuration
  111. # Turn scoped views on. Before rendering "sessions/new", it will first check for
  112. # "users/sessions/new". It's turned off by default because it's slower if you
  113. # are using only default views.
  114. # config.scoped_views = false
  115. # Configure the default scope given to Warden. By default it's the first
  116. # devise role declared in your routes (usually :user).
  117. # config.default_scope = :user
  118. # Configure sign_out behavior.
  119. # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
  120. # The default is true, which means any logout action will sign out all active scopes.
  121. # config.sign_out_all_scopes = true
  122. # ==> Navigation configuration
  123. # Lists the formats that should be treated as navigational. Formats like
  124. # :html, should redirect to the sign in page when the user does not have
  125. # access, but formats like :xml or :json, should return 401.
  126. # If you have any extra navigational formats, like :iphone or :mobile, you
  127. # should add them to the navigational formats lists. Default is [:html]
  128. # config.navigational_formats = [:html, :iphone]
  129. # The default HTTP method used to sign out a resource. Default is :get.
  130. # config.sign_out_via = :get
  131. # ==> OmniAuth
  132. config.omniauth :facebook, 'APP_ID', 'APP_SECRET', scope: 'email,offline_access'
  133. config.omniauth :openid
  134. config.omniauth :openid, name: 'google', identifier: 'https://www.google.com/accounts/o8/id'
  135. # ==> Warden configuration
  136. # If you want to use other strategies, that are not supported by Devise, or
  137. # change the failure app, you can configure them inside the config.warden block.
  138. #
  139. # config.warden do |manager|
  140. # manager.failure_app = AnotherApp
  141. # manager.default_strategies(scope: :user).unshift :some_external_strategy
  142. # end
  143. end