From 995e13f0105cc2261f4a7a2aafcf8475f51400c8 Mon Sep 17 00:00:00 2001 From: Dylan Fisher Date: Thu, 14 Jul 2022 17:42:17 -0400 Subject: [PATCH] Set devise stretches to default 10 I was running into a problem where logging in with a Spree user created after installing this gem was taking around 120 seconds to login in development. I _think_ this was because the devise stretches was set to 20. See this thread for more context https://github.com/heartcombo/devise/issues/1184#issuecomment-1492985. Perhaps when this initializer was set up originally a different encryption strategy was being used and the higher stretches wasn't as slow. To get around the issue while using this gem, just override the stretches config in a `config/devise.rb` initializer in the host app. --- config/initializers/devise.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index baaffe84..e4e8bedc 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -37,7 +37,7 @@ # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 10. If # using other encryptors, it sets how many times you want the password re-encrypted. - config.stretches = 20 + config.stretches = 10 # Setup a pepper to generate the encrypted password. # config.pepper = '<%= SecureRandom.hex(64) %>'