PageRenderTime 77ms CodeModel.GetById 41ms RepoModel.GetById 0ms app.codeStats 0ms

/config/initializers/devise.rb

https://github.com/boy-jer/shapado
Ruby | 138 lines | 17 code | 25 blank | 96 comment | 1 complexity | 8a57f4ade23027cc7e7191ddf434601d MD5 | raw file
  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 = AppConfig.notification_email
  7. # Configure the class responsible to send e-mails.
  8. # config.mailer = "Devise::Mailer"
  9. # ==> ORM configuration
  10. # Load and configure the ORM. Supports :active_record (default), :mongoid
  11. # (bson_ext recommended) and :data_mapper (experimental).
  12. require "devise/orm/mongoid"
  13. # ==> Configuration for any authentication mechanism
  14. # Configure which keys are used when authenticating an user. By default is
  15. # just :email. You can configure it to use [:username, :subdomain], so for
  16. # authenticating an user, both parameters are required. Remember that those
  17. # parameters are used only when authenticating and not when retrieving from
  18. # session. If you need permissions, you should implement that in a before filter.
  19. # config.authentication_keys = [ :email ]
  20. # Tell if authentication through request.params is enabled. True by default.
  21. # config.params_authenticatable = true
  22. # Tell if authentication through HTTP Basic Auth is enabled. True by default.
  23. # config.http_authenticatable = true
  24. # The realm used in Http Basic Authentication
  25. config.http_authentication_realm = AppConfig.application_name
  26. # ==> Configuration for :database_authenticatable
  27. # For bcrypt, this is the cost for hashing the password and defaults to 10. If
  28. # using other encryptors, it sets how many times you want the password re-encrypted.
  29. config.stretches = AppConfig.rest_auth_digest_stretches || 10
  30. # Define which will be the encryption algorithm. Devise also supports encryptors
  31. # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
  32. # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
  33. # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
  34. # config.encryptor = :restful_authentication_sha1
  35. # Setup a pepper to generate the encrypted password.
  36. config.pepper = AppConfig.rest_auth_key
  37. # ==> Configuration for :confirmable
  38. # The time you want to give your user to confirm his account. During this time
  39. # he will be able to access your application without confirming. Default is nil.
  40. # When confirm_within is zero, the user won't be able to sign in without confirming.
  41. # You can use this to let your user access some features of your application
  42. # without confirming the account, but blocking it after a certain period
  43. # (ie 2 days).
  44. # config.confirm_within = 2.days
  45. # ==> Configuration for :rememberable
  46. # The time the user will be remembered without asking for credentials again.
  47. config.remember_for = 2.weeks
  48. # ==> Configuration for :validatable
  49. # Range for password length
  50. # config.password_length = 6..20
  51. # Regex to use to validate the email address
  52. config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
  53. # ==> Configuration for :timeoutable
  54. # The time you want to timeout the user session without activity. After this
  55. # time the user will be asked for credentials again.
  56. # config.timeout_in = 10.minutes
  57. # ==> Configuration for :lockable
  58. # Defines which strategy will be used to lock an account.
  59. # :failed_attempts = Locks an account after a number of failed attempts to sign in.
  60. # :none = No lock strategy. You should handle locking by yourself.
  61. config.lock_strategy = :failed_attempts
  62. # Defines which strategy will be used to unlock an account.
  63. # :email = Sends an unlock link to the user email
  64. # :time = Re-enables login after a certain amount of time (see :unlock_in below)
  65. # :both = Enables both strategies
  66. # :none = No unlock strategy. You should handle unlocking by yourself.
  67. config.unlock_strategy = :both
  68. # Number of authentication tries before locking an account if lock_strategy
  69. # is failed attempts.
  70. config.maximum_attempts = 5
  71. # Time interval to unlock the account if :time is enabled as unlock_strategy.
  72. config.unlock_in = 15.minutes
  73. # ==> Configuration for :token_authenticatable
  74. # Defines name of the authentication token params key
  75. config.token_authentication_key = :auth_token
  76. # ==> Scopes configuration
  77. # Turn scoped views on. Before rendering "sessions/new", it will first check for
  78. # "sessions/users/new". It's turned off by default because it's slower if you
  79. # are using only default views.
  80. # config.scoped_views = true
  81. # By default, devise detects the role accessed based on the url. So whenever
  82. # accessing "/users/sign_in", it knows you are accessing an User. This makes
  83. # routes as "/sign_in" not possible, unless you tell Devise to use the default
  84. # scope, setting true below.
  85. # Note that devise does not generate default routes. You also have to
  86. # specify them in config/routes.rb
  87. # config.use_default_scope = true
  88. # Configure the default scope used by Devise. By default it's the first devise
  89. # role declared in your routes.
  90. config.default_scope = :user
  91. require 'sso_strategy'
  92. config.omniauth :sso_strategy
  93. # ==> Navigation configuration
  94. # Lists the formats that should be treated as navigational. Formats like
  95. # :html, should redirect to the sign in page when the user does not have
  96. # access, but formats like :xml or :json, should return 401.
  97. # If you have any extra navigational formats, like :iphone or :mobile, you
  98. # should add them to the navigational formats lists. Default is [:html]
  99. # config.navigational_formats = [:html, :iphone]
  100. # ==> Warden configuration
  101. # If you want to use other strategies, that are not (yet) supported by Devise,
  102. # you can configure them inside the config.warden block. The example below
  103. # allows you to setup OAuth, using http://github.com/roman/warden_oauth
  104. #
  105. # config.warden do |manager|
  106. # manager.oauth(:twitter) do |twitter|
  107. # twitter.consumer_secret = <YOUR CONSUMER SECRET>
  108. # twitter.consumer_key = <YOUR CONSUMER KEY>
  109. # twitter.options :site => 'http://twitter.com'
  110. # end
  111. # manager.default_strategies(:scope => :user).unshift :twitter_oauth
  112. # end
  113. end