Safer find_by_ call.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11219 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-01-20 13:50:51 +00:00
parent 8357426e79
commit 92b92d6bb8
1 changed files with 2 additions and 2 deletions

View File

@ -134,8 +134,8 @@ class AccountController < ApplicationController
# Token based account activation # Token based account activation
def activate def activate
redirect_to(home_url) && return unless Setting.self_registration? && params[:token] redirect_to(home_url) && return unless Setting.self_registration? && params[:token].present?
token = Token.find_by_action_and_value('register', params[:token]) token = Token.find_by_action_and_value('register', params[:token].to_s)
redirect_to(home_url) && return unless token and !token.expired? redirect_to(home_url) && return unless token and !token.expired?
user = token.user user = token.user
redirect_to(home_url) && return unless user.registered? redirect_to(home_url) && return unless user.registered?