From 4a0f4081ff5513d805bf6a6c2baca78e46bfbb24 Mon Sep 17 00:00:00 2001 From: Bomrah Harry Date: Thu, 5 Oct 2023 00:38:24 +0800 Subject: [PATCH] new stuff --- .../admin/seminar_signups_controller.rb | 13 ++- app/controllers/admin/seminars_controller.rb | 33 ++++--- app/controllers/seminars_controller.rb | 98 +++++++++++++++++-- app/models/seminar_email_set.rb | 1 + app/models/seminar_signup.rb | 17 +++- app/models/seminar_signup_field_set.rb | 1 + app/views/admin/seminar_signups/edit.html.erb | 85 +++++++++++++++- app/views/admin/seminars/_form.html.erb | 31 +++++- .../_seminar_signup_render_table.html.erb | 16 ++- app/views/email/reset_password_email.html.erb | 9 ++ .../email/special_reminder_email.html.erb | 9 ++ app/views/seminars/con_login.html.erb | 3 + .../seminars/confirm_email_page.html.erb | 21 ++++ app/views/seminars/reset_email.html.erb | 50 ++++++++++ .../seminars/reset_password_page.html.erb | 74 ++++++++++++++ app/views/seminars/show.html.erb | 8 +- config/locales/en.yml | 38 ++++++- config/locales/zh_tw.yml | 37 ++++++- config/routes.rb | 9 +- 19 files changed, 515 insertions(+), 38 deletions(-) create mode 100644 app/views/email/reset_password_email.html.erb create mode 100644 app/views/email/special_reminder_email.html.erb create mode 100644 app/views/seminars/confirm_email_page.html.erb create mode 100644 app/views/seminars/reset_email.html.erb create mode 100644 app/views/seminars/reset_password_page.html.erb diff --git a/app/controllers/admin/seminar_signups_controller.rb b/app/controllers/admin/seminar_signups_controller.rb index c6a2e14..7e80fde 100644 --- a/app/controllers/admin/seminar_signups_controller.rb +++ b/app/controllers/admin/seminar_signups_controller.rb @@ -24,12 +24,12 @@ class Admin::SeminarSignupsController < OrbitAdminController @seminar_signup = SeminarSignup.find(params[:id]) @seminar = SeminarMain.find(@seminar_signup.seminar_main_id) - @form_index = 0 + @form_index = 0 end def update - + @seminar_signup = SeminarSignup.find(params[:id]) @seminar_signup.update_attributes(seminar_signup_params) @@ -63,6 +63,15 @@ class Admin::SeminarSignupsController < OrbitAdminController redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup" end + def get_predefined_text + seminar = SeminarMain.find(params[:seminar_id]) + text = seminar.seminar_email_sets.where(:field_name => params[:type]).first.content[I18n.locale] + render :json => { + "success" => true, + "html" => text + } + end + private def seminar_signup_params diff --git a/app/controllers/admin/seminars_controller.rb b/app/controllers/admin/seminars_controller.rb index 5c2216b..d00a22e 100644 --- a/app/controllers/admin/seminars_controller.rb +++ b/app/controllers/admin/seminars_controller.rb @@ -90,7 +90,7 @@ class Admin::SeminarsController < OrbitAdminController # exceptions = ["personal_book","personal_conference","personal_diploma","personal_experience","personal_journal","personal_lab","personal_patent","personal_project","personal_research"] exceptions = [] @modules = ModuleApp.where(:key.nin => exceptions).frontend_enabled.order_by(:key=>'asc') - @searchfilter = @modules.collect{|m|[t('module_name.'+m.key),m.key]} + @searchfilter = @modules.collect{|m|[t('module_name.'+m.key),m.key]} end def reviewer_setting @seminar_reviews = @seminar.seminar_reviews @@ -296,7 +296,7 @@ class Admin::SeminarsController < OrbitAdminController end elsif params[:mode] == "hide" if seminar_main.session_show_ids.nil? - seminar_main.session_show_ids = (0...seminar_main.summary_chioices.count).to_a[0..1] + seminar_main.session_show_ids = (0...seminar_main.summary_chioices.count).to_a[0..1] end seminar_main.session_show_ids.delete(session_id) elsif params[:mode] == "show" @@ -356,13 +356,13 @@ class Admin::SeminarsController < OrbitAdminController @filter_fields = filter_fields(@categories) @table_fields = [:category, 'seminar.title', 'seminar.event_during', 'seminar.signup_during', 'seminar.signup_count', 'seminar.export'] - if !params[:sort].blank? + if !params[:sort].blank? if params[:sort] == 'event_during' - sort = {:seminar_start_date.to_sym=>params[:order]} + sort = {:seminar_start_date.to_sym=>params[:order]} elsif params[:sort] == 'signup_during' - sort = {:signup_start_date.to_sym=>params[:order]} + sort = {:signup_start_date.to_sym=>params[:order]} else - sort = {params[:sort].to_sym=>params[:order]} + sort = {params[:sort].to_sym=>params[:order]} end else sort = {:signup_start_date=>"desc",:created_at=>"desc"} @@ -432,7 +432,7 @@ class Admin::SeminarsController < OrbitAdminController end def create - + if !seminar_params['seminar_links_attributes'].nil? seminar_params['seminar_links_attributes'].each do |idx,link| seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank? @@ -494,7 +494,7 @@ class Admin::SeminarsController < OrbitAdminController def update @seminar_params = seminar_params rescue {} if @seminar_params.count != 0 - @seminar_params[:registration_status] = (@seminar_params[:registration_status] ? @seminar_params[:registration_status] : []) + @seminar_params[:registration_status] = (@seminar_params[:registration_status] ? @seminar_params[:registration_status] : []) uid = params[:id].split('-').last @seminar = SeminarMain.find_by(:uid=>uid) if @seminar_params.has_key?("title_translations") @@ -545,7 +545,7 @@ class Admin::SeminarsController < OrbitAdminController seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank? end end - + @seminar.update_user_id = current_user.id if @seminar.update_attributes(seminar_params) @seminar.update_enable_recaptcha @@ -559,7 +559,7 @@ class Admin::SeminarsController < OrbitAdminController end redirect_to admin_seminars_path end - + def set_write_off @seminar.donation_write_off_status = true @@ -578,14 +578,14 @@ class Admin::SeminarsController < OrbitAdminController def seminar_signup_field @field_name = 'seminar_main' - @attribute = SeminarMain.find(params[:id]) + @attribute = SeminarMain.find(params[:id]) @attribute_type = 'seminar' @class = 'seminars' end def seminar_submission_field @field_name = 'seminar_main' - @attribute = SeminarMain.find(params[:id]) + @attribute = SeminarMain.find(params[:id]) @attribute_type = 'seminar' @class = 'seminars' end @@ -672,7 +672,7 @@ class Admin::SeminarsController < OrbitAdminController end def delete_seminar_signup - + @seminar_signup = SeminarSignup.find(params[:id]) @seminar_id = @seminar_signup.seminar_main_id @@ -682,6 +682,11 @@ class Admin::SeminarsController < OrbitAdminController redirect_to "/admin/seminars/@seminar_id.to_s/seminar_signup" end + def create_email_set + SeminarEmailSet.create_new_fields(params[:id]) + redirect_to "/admin/seminars/#{params[:id]}/edit" + end + private def set_seminar @@ -758,7 +763,7 @@ class Admin::SeminarsController < OrbitAdminController end end @email_set = [] - ['signup','submission','add_file','edit_file'].each do |field_name| + ['signup','submission','add_file','edit_file', 'reset_password', "special_reminder"].each do |field_name| email_set = @seminar.seminar_email_sets.select{|v| v.field_name==field_name} if email_set.length==0 title = Hash.new diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index 50bae30..7b4c933 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -3,18 +3,18 @@ class SeminarsController < ApplicationController include MemberHelper include ActionView::Context #vary important (only add this can access @@session from view) include Admin::SeminarsHelper - FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout"] + FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout","confirm_email_page","reset_password_page"] # include SimpleCaptcha::ControllerHelpers def index time_now = Time.now - + seminars = SeminarMain.all.desc(:seminar_start_date).filter_by_categories { "seminars" => seminars, 'time_now' => time_now, "total_pages" => seminars.total_pages - } + } end def widget @@ -85,7 +85,7 @@ class SeminarsController < ApplicationController prefix_url = OrbitHelper.request.path.split("-").first + "-#{params[:uid]}" @prefix_url = prefix_url @registration_postfix = "/home/registration" - header_data = "Home | " + + header_data = "Home | " + "Main Site" content_style = seminar_template_setting.content_style background_style = seminar_template_setting.background_style @@ -392,7 +392,7 @@ class SeminarsController < ApplicationController params = OrbitHelper.params - if !params[:email].blank? + if !params[:email].blank? count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count result = count > 0 ? t('seminar.already_used') : t('seminar.available') @@ -490,6 +490,9 @@ class SeminarsController < ApplicationController :seminar_signup=>@seminar_signup},:layout=>false) if params['seminar_signup']['status']=='C' status_param = '&status=' + if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation) + extra_text += "
" + t("seminar.click_here_to_confirm") + "
" + end send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text) else status_param = '' @@ -733,6 +736,44 @@ class SeminarsController < ApplicationController end + def reset_email + end + + def reset_password_page + params = OrbitHelper.params + seminar = SeminarMain.find_by(uid: params[:uid]) + seminar_signup = seminar.seminar_signups.where(:status=>'C', :id=> params[:cid], :token => params[:token]).first + status = false + if(!seminar_signup.nil?) + status = true + end + { + "status" => status, + "seminar" => seminar, + "cid" => params[:cid], + "token" => params[:token] + } + end + + def confirm_email_page + confirm = false + params = OrbitHelper.params + seminar = SeminarMain.where(:uid => params[:uid]).first + if(!seminar.nil?) + signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token], :is_confirmed => false).first + if(!signup.nil?) + signup.token = nil + signup.is_confirmed = true + signup.save + confirm = true + end + end + { + "confirm" => confirm, + "url" => OrbitHelper.url_to_show(seminar.to_param) + } + end + def con_login_proc seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id]) @@ -751,6 +792,35 @@ class SeminarsController < ApplicationController end + def reset_confirm_password_proc + params = OrbitHelper.params + seminar = SeminarMain.find(params[:seminar_id]) + redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_password_page" if seminar.nil? + + seminar_signup = seminar.seminar_signups.where(:status =>'C', :token => params[:reset_token], :id => params[:cid]).first + if !seminar_signup.blank? + seminar_signup.password = params[:password] + seminar_signup.token = nil + seminar_signup.save + redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed') + else + redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed_not_ok') + end + end + + def reset_password_proc + @seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id]) + seminar_signup = SeminarSignup.where(:status=>'C', :email=> params[:user_name], :seminar_main_id => params[:seminar_signup][:seminar_main_id]).first + if !seminar_signup.blank? + token = seminar_signup.generate_token + extra_text = "
#{t("seminar_signup.click_on_link")}" + send_mail('reset_password', seminar_signup.email, @seminar.id.to_s, extra_text) + redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_email", :notice => t('seminar_signup.reset_email_sent') + else + redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_email", :notice => t('seminar_signup.email_not_found') + end + end + def seminar_signup_params params.require(:seminar_signup).permit! end @@ -759,6 +829,22 @@ class SeminarsController < ApplicationController params.require(:seminar_signup_contribute).permit! end + def send_notifying_email + @seminar = SeminarMain.find_by(:id => params[:seminar_id]) + seminar_signup = @seminar.seminar_signups.where(:email => params[:email]).first + if !seminar_signup.blank? + extra_text = "

#{params[:text]}

" + if params[:type] == "reset_password" + token = seminar_signup.generate_token + extra_text += "
#{t("seminar_signup.click_on_link")}" + end + send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text) + end + render :json => { + "success" => true + }.to_json + end + def seminar_signup_values_params params.require(:seminar_signup_values).permit! end @@ -778,6 +864,6 @@ class SeminarsController < ApplicationController mail_sentdate:Time.current, mail_subject: email_set[0].title[I18n.locale], template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text}) - end + end end end diff --git a/app/models/seminar_email_set.rb b/app/models/seminar_email_set.rb index f22f0c7..3d0a3d2 100644 --- a/app/models/seminar_email_set.rb +++ b/app/models/seminar_email_set.rb @@ -6,5 +6,6 @@ class SeminarEmailSet field :title field :content field :disabled, type: Boolean, default: false + field :is_confirmation, type: Boolean, default: false belongs_to :seminar_main end diff --git a/app/models/seminar_signup.rb b/app/models/seminar_signup.rb index fefd159..7e8c060 100644 --- a/app/models/seminar_signup.rb +++ b/app/models/seminar_signup.rb @@ -3,11 +3,14 @@ class SeminarSignup include Mongoid::Document include Mongoid::Timestamps - HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename"] + HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename", "token", "reset_token"] DefaultEnableFields = ['status','name','tel','phone','email','password','recaptcha'] field :sort_number , type: Integer, default: 10000 field :status + field :token + field :is_confirmed, type: Boolean, default: false # for email confirmation + field :signup_confirmed, type: Boolean, default: false field :name # become Last Name for TICC field :tel, type: String # become First Name for TICC field :unit, localize: true #Only localize for preserving old record @@ -26,7 +29,7 @@ class SeminarSignup field :seminar_session_ids, type: Array, default: [] has_many :seminar_signup_values, :autosave => true, :dependent => :destroy has_many :seminar_signup_contributes, :autosave => true, :dependent => :destroy - + accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true scope :sort_ordered, ->{ order_by(:sort_number=>1,:created_at=>1) } @@ -55,6 +58,7 @@ class SeminarSignup self.serial_number = last_serial_number + 1 SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}}) end + self.token = SecureRandom.hex(5) end after_destroy do seminar_main = self.seminar_main @@ -69,7 +73,7 @@ class SeminarSignup sr.save end end - seminar_main.seminar_signups.delete(self) #avoid resave + seminar_main.seminar_signups.delete(self) #avoid resave if seminar_main.unassigned_seminar_signup_ids.delete(id) seminar_main.save end @@ -80,6 +84,13 @@ class SeminarSignup seminar_session.save end end + + def generate_token + token = SecureRandom.hex(5) + self.token = token + self.save + return token + end def display_serial_number display_format_string(self.serial_number,4) end diff --git a/app/models/seminar_signup_field_set.rb b/app/models/seminar_signup_field_set.rb index 0470192..f1c7810 100644 --- a/app/models/seminar_signup_field_set.rb +++ b/app/models/seminar_signup_field_set.rb @@ -5,6 +5,7 @@ class SeminarSignupFieldSet field :field_name, type: String field :placeholder field :name + field :validator field :disabled, type: Boolean, default: false field :hidden, type: Boolean, default: false belongs_to :seminar_main diff --git a/app/views/admin/seminar_signups/edit.html.erb b/app/views/admin/seminar_signups/edit.html.erb index a1f1682..fc97a23 100644 --- a/app/views/admin/seminar_signups/edit.html.erb +++ b/app/views/admin/seminar_signups/edit.html.erb @@ -92,6 +92,37 @@
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
+
+
+ +
+ +
+
+
+
+ +
+

 

+
+
+
+
+ +
+ +
+
+
+
+ +
<% elsif signup_field.field_name == 'note' %>
@@ -178,7 +209,12 @@ <% end %> - +
+ +
@@ -193,4 +229,49 @@ -<% end %> \ No newline at end of file +<% end %> + \ No newline at end of file diff --git a/app/views/admin/seminars/_form.html.erb b/app/views/admin/seminars/_form.html.erb index b35f000..9ab7457 100644 --- a/app/views/admin/seminars/_form.html.erb +++ b/app/views/admin/seminars/_form.html.erb @@ -184,6 +184,7 @@ <%= t('seminar.placeholder') %> <%= t('seminar.disable') %> <%= t('seminar.hidden') %> + <%= t('seminar.validator') %>
(Use regex pattern) <% @signup_sets.each_with_index do |attr_signup,signup_index| %> @@ -208,6 +209,13 @@ <%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %> <% end %> + <% if attr_signup.field_name == "password" %> + + <%= text_field_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][validator]", attr_signup.validator) %> + + <% else %> +   + <% end %> <% end %> @@ -325,9 +333,19 @@ <%= t('seminar.email_edit_file') %> +
  • + + <%= t('seminar.email_forgot_password') %> + +
  • +
  • + + <%= t('seminar.email_special_reminder') %> + +
  • - <% (0..3).each do |index1| %> + <% (0..5).each do |index1| %> <% active_email_set = index1==0 ? ' active' : '' %>
    @@ -341,6 +359,17 @@ <%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][disabled]", true ,@email_set[index1].disabled) %> + <% if index1 == 0 %> + + + + + <% end %>
    + <%= t('seminar.is_confirmation') %> + + + <%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]", true ,@email_set[index1].is_confirmation) %> +
    <%= t('seminar.email_title') %> diff --git a/app/views/admin/seminars/_seminar_signup_render_table.html.erb b/app/views/admin/seminars/_seminar_signup_render_table.html.erb index 5db3753..6a721ca 100644 --- a/app/views/admin/seminars/_seminar_signup_render_table.html.erb +++ b/app/views/admin/seminars/_seminar_signup_render_table.html.erb @@ -60,6 +60,20 @@ %> <% elsif names[1] == 'status' %> <% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %> + <% elsif names[1] == 'is_confirmed' %> + <% if seminar_signup.is_confirmed + val = "#{t("seminar_signup.email_confirmed")}" + else + val = "#{t("seminar_signup.email_not_confirmed")}" + end + %> + <% elsif names[1] == 'signup_confirmed' %> + <% if seminar_signup.signup_confirmed + val = "#{t("seminar_signup.signup_confirmed")}" + else + val = "#{t("seminar_signup.signup_not_confirmed")}" + end + %> <% elsif names[1] != 'recaptcha' %> <% val = seminar_signup.send("#{names[1]}") %> <% end %> @@ -77,7 +91,7 @@ %> <% elsif names[2] == "tel" %> <% val = seminar_signup.tel %> - <% elsif names[2] == "registration_status" %> + <% elsif names[2] == "registration_status" %> <% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %> <% end %> <% elsif names[0] == "seminar_signup_field_custom" || names[0] == "seminar_signup_fields" %> diff --git a/app/views/email/reset_password_email.html.erb b/app/views/email/reset_password_email.html.erb new file mode 100644 index 0000000..2fada6d --- /dev/null +++ b/app/views/email/reset_password_email.html.erb @@ -0,0 +1,9 @@ +<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'reset_password'} %> +<% if email_set.length != 0 %> + <% if !(email_set[0].content.nil?) %> + <%= email_set[0].content[@data['locale']].html_safe %> + <% end %> +<% else %> + <%= t('seminar.email_add_file_content') %> +<% end %> +<%= (@data['extra_text'] rescue "").to_s.html_safe %> \ No newline at end of file diff --git a/app/views/email/special_reminder_email.html.erb b/app/views/email/special_reminder_email.html.erb new file mode 100644 index 0000000..c0ef16f --- /dev/null +++ b/app/views/email/special_reminder_email.html.erb @@ -0,0 +1,9 @@ +<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'special_reminder'} %> +<% if email_set.length != 0 %> + <% if !(email_set[0].content.nil?) %> + <%= email_set[0].content[@data['locale']].html_safe %> + <% end %> +<% else %> + <%= t('seminar.email_add_file_content') %> +<% end %> +<%= (@data['extra_text'] rescue "").to_s.html_safe %> \ No newline at end of file diff --git a/app/views/seminars/con_login.html.erb b/app/views/seminars/con_login.html.erb index 7125135..1322fa2 100644 --- a/app/views/seminars/con_login.html.erb +++ b/app/views/seminars/con_login.html.erb @@ -39,6 +39,9 @@ <%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %>
    + "> diff --git a/app/views/seminars/confirm_email_page.html.erb b/app/views/seminars/confirm_email_page.html.erb new file mode 100644 index 0000000..9a78014 --- /dev/null +++ b/app/views/seminars/confirm_email_page.html.erb @@ -0,0 +1,21 @@ +<% # encoding: utf-8 %> +<% + data = action_data("confirm_email_page") + if data["url"] + url = data["url"] + end +%> +
    +<% if (data['confirm'] == true) %> + <%= t('seminar_signup.confirm_ok') %> +
    + + <%= t('seminar.click_to_contribute') %> + +<% else %> + <%= t('seminar_signup.confirm_not_ok') %> +
    + + <%= t('seminar.back') %> + +<% end %> diff --git a/app/views/seminars/reset_email.html.erb b/app/views/seminars/reset_email.html.erb new file mode 100644 index 0000000..811b9ca --- /dev/null +++ b/app/views/seminars/reset_email.html.erb @@ -0,0 +1,50 @@ +<% # encoding: utf-8 %> +<% + data = action_data("con_login") + @seminar = data["seminar"] + @time_now = data["time_now"] +%> + + +
    + +
    + \ No newline at end of file diff --git a/app/views/seminars/reset_password_page.html.erb b/app/views/seminars/reset_password_page.html.erb new file mode 100644 index 0000000..0f9bd7b --- /dev/null +++ b/app/views/seminars/reset_password_page.html.erb @@ -0,0 +1,74 @@ +<% # encoding: utf-8 %> +<% + data = action_data + @seminar = data["seminar"] +%> + + +
    +<% if data["status"] %> + + <% else %> +

    Invalid URL

    + <% end %> +
    + \ No newline at end of file diff --git a/app/views/seminars/show.html.erb b/app/views/seminars/show.html.erb index 6808bed..cc5b2b1 100644 --- a/app/views/seminars/show.html.erb +++ b/app/views/seminars/show.html.erb @@ -124,7 +124,11 @@ <% elsif signup_field.field_name == 'email' %>
    - <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %> check mail + <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %> check mail +
    + <% elsif signup_field.field_name == 'password' %> +
    + <%= f.password_field :password, :class=>"input-medium form-control availibility", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :pattern => signup_field.validator, :title => t("seminar_signup.password_check") %>
    <% elsif signup_field.field_name == 'note' %>
    @@ -147,7 +151,7 @@
    <% else %>
    - <%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %> + <%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
    <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index c316bfa..4292f4e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -102,6 +102,21 @@ en: email_edit_file: Edit file email_add_file: Add file auto_send_email_set: Auto send email setting + email_forgot_password: Forgot Password + email_special_reminder: Special Reminder + email_reset_password_content: Forgot Password + email_reset_password_success: Forgot Password + email_special_reminder_content: Special Reminder + email_special_reminder_success: Special Reminder + is_confirmation: Confirmation Email + select_email_type: Select Email Type + send_email_text: Additional text to send + send_email_button: Send email + predefined_text: Predifined email text + click_here_to_confirm: Click this link to confirm + confirm_ok: Email confirmed + confirm_not_ok: Email cannot be confirmed + validator: Validator click_to_contribute: Click here to contribute required: Required already_used: Already Used @@ -119,7 +134,6 @@ en: reviewer: Reviewer #審查委員 review_end_date: Review End Date #審查結束日期 review_start_date: Review Start Date #審查開始日期 - review: Reveiw #審稿 blank_no_limit: Allow Blank Value #空白無限制 export_csv: Export CSV #匯出CSV recaptcha: Recaptcha #驗證碼 @@ -212,4 +226,24 @@ en: select: Select box checkbox: Multiple choice radio: Single choice - choices: Choices \ No newline at end of file + choices: Choices + forgot_password: Forgot Password + reset_email_sent: Reset Email Sent + login_failed: Login Failed + email_not_found: Email not found + reset: Reset + email_reset_password_success: Password reset + click_on_link: Please click on the link below to reset your password + confirm_password: Confirm Password + password_mismatch: Password mismatch + password_changed: Password changed successfully + password_changed_not_ok: There was an error changing password + password_check: Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters + email_check: Invalid email format + is_confirmed: Email Confirmed + signup_confirmed: Signup Confirmed + registration_complete: Registration Complete + email_confirmed: Email Confirmed + email_not_confirmed: Email not confirmed + signup_not_confirmed: Signup not confirmed + send_email: Send Email \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index a31cc88..ceb5805 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -103,6 +103,21 @@ zh_tw: email_edit_file: 編輯上傳 email_add_file: 新增上傳 auto_send_email_set: 自動發信設定 + email_forgot_password: Forgot Password + email_special_reminder: Special Reminder + email_reset_password_content: Forgot Password + email_reset_password_success: Forgot Password + email_special_reminder_content: Special Reminder + email_special_reminder_success: Special Reminder + is_confirmation: Confirmation Email + click_here_to_confirm: Click this link to confirm + confirm_ok: Email confirmed + confirm_not_ok: Email cannot be confirmed + select_email_type: Select Email Type + send_email_text: Additional text to send + predefined_text: Predifined email text + send_email_button: Send email + validator: Validator click_to_contribute: 按此登入投稿 required: '必填, necessary' already_used: 已存在 @@ -120,7 +135,6 @@ zh_tw: reviewer: 審查委員 review_end_date: 審查結束日期 review_start_date: 審查開始日期 - review: 審稿 blank_no_limit: 空白無限制 export_csv: 匯出CSV recaptcha: 驗證碼 @@ -213,4 +227,23 @@ zh_tw: select: 下拉選單 checkbox: 多選 radio: 單選 - choices: 選項 \ No newline at end of file + choices: 選項 + forgot_password: Forgot Password + reset_email_sent: Reset Email Sent + login_failed: 登入失敗 + email_not_found: Email not found + reset: Reset + click_on_link: 請點選下方連結後重設密碼。 + confirm_password: Confirm Password + password_mismatch: Password missmatch + password_changed: Password changed successfully + password_changed_not_ok: There was an error changing password + password_check: Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters + email_check: Invalid email format + is_confirmed: Email Confirmed + signup_confirmed: Signup Confirmed + registration_complete: Registration Complete + email_confirmed: Email Confirmed + email_not_confirmed: Email not confirmed + signup_not_confirmed: Signup not confirmed + send_email: Send Email \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 0fc54f5..18976dd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -53,7 +53,7 @@ Rails.application.routes.draw do SeminarSubmissionField.create_indexes end locales = Site.first.in_use_locales rescue I18n.available_locales - + scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do resources :seminars do @@ -89,6 +89,7 @@ Rails.application.routes.draw do post 'delete_items' end end + get "seminar_signups/get_predefined_text" => "seminar_signups#get_predefined_text" resources :seminar_agreements resources :seminar_signups resources :seminar_submission_values @@ -101,12 +102,14 @@ Rails.application.routes.draw do get ':slug_title-:uid', to: 'seminars#show' post 'con_login_proc', to: 'seminars#con_login_proc' post 'con_logout_proc', to: 'seminars#con_logout_proc' + post 'reset_password_proc', to: 'seminars#reset_password_proc' + post 'reset_confirm_password_proc', to: 'seminars#reset_confirm_password_proc' post 'add_file_proc', to: 'seminars#add_file_proc' post 'edit_file_proc', to: 'seminars#edit_file_proc' post 'del_file', to: 'seminars#del_file' end end - + post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email" end - + end