2014-09-01 1 views
0

localhost : 3000에서 확인 이메일에 등록합니다. 나는 내 이메일을 열고 다음받은 편지함 쇼 메시지에 당신은 아래의 링크를 통해 계정 이메일을 확인할 수 있습니다 이미 등록 할 때 내 development.rb에 나는이오류로 인해이 사용자가 저장되지 않았습니다. 확인 토큰이 잘못되었습니다.

config.action_mailer.default_url_options = {:host => 'localhost:3000'} 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.smtp_settings = { 
    :address => 'smtp.gmail.com', 
    :port => '587', 
    :authentication => :plain, 
    :user_name => '[email protected]', 
    :password  => 'mypassword', 
    :domain => 'localhost:3000', 
    :enable_starttls_auto => true 
} 

같은 추가 :이 링크를 클릭 계정을 확인합니다. 그것은 로컬 호스트로 리디렉션 : 3000/사용자/sign_in 그리고 난 내받은 편지함에 (내 accoun 확인)이 링크에서이 같은 다시 .IT 쇼 오류를 클릭하면 내가 성공적으로 나누었다 로그인 할 수 있습니다 : URL에

: http://localhost:3000/users/confirmation?confirmation_token=dWUeHVP_N7VzsVwvkNW5

meassage 오류 :

내가 링크를 클릭 내 이메일받은 편지함에서
Resend confirmation instructions 
1 error prohibited this user from being saved: 
Confirmation token is invalid 

"내 계정 확인"다시 내가 그것을 로컬 호스트로 리디렉션합니다 : 3000/사용자/sign_in. "내 계정 확인"링크를 다시 클릭하면 어떻게 localhost : 3000/users/sign_in으로 리디렉션 할 수 있습니까? 도와주세요!

+0

궁금하십니까? –

+0

예 저는 지금 –

답변

1

confirmation_token이 nil이되어 확인 링크를 한 번만 사용할 수 있으며이 오류가 발생합니다. 확인을 이미 완료 한 경우 일부를 sign_in url로 리디렉션하려는 경우 그런 다음 장치 확인 컨트롤러를 무시해야합니다.

def show 
    self.resource = resource_class.confirm_by_token(params[:confirmation_token]) 
    if resource.errors.empty? 
    set_flash_message(:notice, :confirmed) if is_flashing_format? 
    sign_in(resource_name, resource) 
    respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) } 
    else 
    redirect_to new_user_session_path 
    #respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new } 
    end 
end 
+0

의 장치를 사용하고 있습니다. 나는 당신의 대답에 대해 대단히 감사합니다. –

관련 문제