Fix a problem where you might see missing {{sentTo}} value after a failed login

This commit is contained in:
Neil Lalonde 2013-04-18 16:44:56 -04:00
parent f76d6c0f3f
commit cbe0168922

View File

@ -27,7 +27,12 @@ class SessionController < ApplicationController
render_serialized(@user, UserSerializer)
return
else
render json: {error: I18n.t("login.not_activated"), reason: 'not_activated', sent_to_email: @user.email_logs.where(email_type: 'signup').order('created_at DESC').first.try(:to_address), current_email: @user.email}
render json: {
error: I18n.t("login.not_activated"),
reason: 'not_activated',
sent_to_email: @user.email_logs.where(email_type: 'signup').order('created_at DESC').first.try(:to_address) || @user.email,
current_email: @user.email
}
return
end
end