2012-11-23 5 views
0

Sorcery를 사용하도록 애플리케이션을 설정하려고합니다. 내 사용자 모델에 authenticates_with_sorcery!을 추가하면 내 사양이 실제로 느리게 실행됩니다 (초당 약 1 회). 어떤 종류의 구성이 있거나 Sorcery에서 이것을 일으킬 수있는 설정이 있습니까?Sorcery 스펙이 실제로 느림

# This model represents a user of the application, disregarding that person's use of the system. For 
# instance, a user could be a job hunter, an employer, an administrator, or some other stakeholder. 
class User < ActiveRecord::Base 
    authenticates_with_sorcery! 

    attr_accessible :email, :password, :password_confirmation 

    # validations 
    validates :email, 
      :presence => true, 
      :uniqueness => true, 
      :format => /[^@][email protected][^@]+\.[^@]+/ 

    validates :password, :presence => true, :confirmation => true 

    validates :password_confirmation, :presence => true 

    # before filters 
    before_save :sanitize_email 

    private 

    # Strips and removes HTML tags from the email parameter. 
    def sanitize_email 
    self.email = email.strip 

    # remove anything that looks like an email 
    self.email = email.gsub(/<[^<>]+>/, "") 
    end 
end 

내 사용자 공장 :

require 'factory_girl' 
require 'ffaker' 

FactoryGirl.define do 

    sequence :email do |n| 
    "email#{n}@example.com" 
    end 

    factory :user do |f| 
    email 
    password "password" 
    password_confirmation "password" 
    end 
end 

답변

2

내 첫번째 추측 느린 비밀번호 암호화입니다

은 여기 내 사용자 모델입니다. 예를 들어, 우리는 config.stretches 구성 변수를 테스트 env에서 작은 수로 설정할 수 있습니다.

체크 What does the "stretches" of database_authenticatable of devise mean?

+0

당신 말이 맞았습니다. 비밀번호 암호화로 인해 속도가 느려졌습니다. – LandonSchropp

+0

이 문제를 해결 했습니까? 마법 암호 암호화를 비활성화하는 방법은 무엇입니까? –