gotcha verification

This commit is contained in:
Harry Bomrah 2016-08-04 16:25:40 +08:00
parent df953bda4b
commit 18076d343d
2 changed files with 16 additions and 13 deletions

View File

@ -135,24 +135,27 @@ class SeminarsController < ApplicationController
@signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: params[:seminar_signup][:seminar_main_id] ).first
@seminar_signup = SeminarSignup.new(seminar_signup_params)
if gotcha_valid?
if @signup.blank? && @seminar_signup.save
# if gotcha_valid? && @seminar_signup.save
if @signup.blank? && @seminar_signup.save
# if gotcha_valid? && @seminar_signup.save
if !params[:seminar_signup_values].nil?
seminar_signup_values_params.each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value)
end
end
if !params[:seminar_signup_values].nil?
seminar_signup_values_params.each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value)
redirect_to "#{params[:referer_url]}/?method=signup_ok"
else
if !@signup.blank?
redirect_to "#{params[:referer_url]}", :notice => 'mail已存在'
else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end
end
redirect_to "#{params[:referer_url]}/?method=signup_ok"
else
if !@signup.blank?
redirect_to "#{params[:referer_url]}", :notice => 'mail已存在'
else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end
end
end

View File

@ -158,7 +158,7 @@ class SeminarSignupValue
@seminar_signup_field_value.update(field_value_param) rescue nil
@seminar_signup_field_value.save rescue nil
else
@seminar_signup_field_value = member.seminar_signup_values.build(field_value_param) #rescue nil
@seminar_signup_field_value = member.seminar_signup_values.build(field_value_param) rescue nil
@seminar_signup_field_value.save
end
return @seminar_signup_field_value