added confirm counter, re signup msg, added token

This commit is contained in:
Bomrah Harry 2023-10-12 21:12:15 +08:00
parent a38f3214b1
commit 4dbd540335
3 changed files with 7 additions and 4 deletions

View File

@ -392,7 +392,7 @@ class SeminarsController < ApplicationController
}
end
{
"seminar" => seminar,
"seminar_signup" => seminar_signup,
@ -545,6 +545,7 @@ class SeminarsController < ApplicationController
tmp_seminar_signup_params = seminar_signup_params
@seminar_signup = SeminarSignup.find(params[:signup_id])
@seminar_signup.update_attributes(tmp_seminar_signup_params)
@seminar_signup.generate_token
if !params[:seminar_signup_values].nil?
params[:seminar_signup_values].each_with_index do |r,i|
field_value = r.last[:id].present?
@ -574,7 +575,7 @@ class SeminarsController < ApplicationController
end
send_mail('signup',tmp_seminar_signup_params[:email],tmp_seminar_signup_params[:seminar_main_id],extra_text)
end
redirect_with_js("#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=con_upload")
redirect_with_js("#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}&seminar=#{@seminar.uid}")
end
def signup_ok
@ -863,11 +864,12 @@ class SeminarsController < ApplicationController
end
seminar = SeminarMain.where(:uid => uid).first
if(!seminar.nil?)
signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token], :is_confirmed => false).first
signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token]).first
if(!signup.nil?)
signup.token = nil
signup.is_confirmed = true
signup.is_confirmed_date = DateTime.now
signup.signup_confirmed_counter = signup.signup_confirmed_counter + 1
signup.save
confirm = true
end

View File

@ -13,6 +13,7 @@ class SeminarSignup
field :signup_confirmed, type: Boolean, default: false
field :is_confirmed_date, type: DateTime
field :signup_confirmed_date, type: DateTime
field :signup_confirmed_counter, type: Integer, default: 0
field :emails_sent, type: Array, default: []
field :emails_sent_time, type: Array, default: []
field :name # become Last Name for TICC

View File

@ -66,7 +66,7 @@
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% elsif names[1] == 'is_confirmed' %>
<% if seminar_signup.is_confirmed
val = "<span class='label label-success'>#{t("seminar_signup.email_confirmed")}</span>"
val = "<span class='label label-success'>#{t("seminar_signup.email_confirmed")}(#{seminar_signup.signup_confirmed_counter.to_s})</span>"
else
val = "<span class='label label-danger'>#{t("seminar_signup.email_not_confirmed")}</span>"
end