Skip to content

Commit 945015b

Browse files
authored
Merge pull request #731 from TrustTheVote-Project/production
Get latest updates into main
2 parents 1d26575 + ba53af4 commit 945015b

22 files changed

Lines changed: 120 additions & 63 deletions

Gemfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ gem 'twilio-ruby' #, '~> 4.11.1'
1717
gem 'will_paginate'
1818

1919
#gem 'utf8-cleaner'
20-
gem 'rack', "2.2.11"
2120
gem 'rack-robustness'
2221

2322
gem "authlogic" #, "= 4.3.0"
@@ -125,6 +124,3 @@ gem "delayed_job_active_record" #, "~> 4.1"
125124
gem 'delayed_cron_job'
126125

127126
gem 'exception_notification'
128-
129-
gem "net-imap", "0.3.8"
130-
gem "rexml", "3.3.9"

Gemfile.lock

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ GEM
12111211
activerecord (>= 5.a)
12121212
database_cleaner-core (~> 2.0.0)
12131213
database_cleaner-core (2.0.1)
1214-
date (3.4.1)
1214+
date (3.3.4)
12151215
deep_merge (1.2.1)
12161216
delayed_cron_job (0.7.4)
12171217
delayed_job (>= 4.1)
@@ -1378,7 +1378,7 @@ GEM
13781378
net-http-digest_auth (1.4.1)
13791379
net-http-persistent (4.0.1)
13801380
connection_pool (~> 2.2)
1381-
net-imap (0.3.8)
1381+
net-imap (0.3.7)
13821382
date
13831383
net-protocol
13841384
net-pop (0.1.2)
@@ -1408,7 +1408,7 @@ GEM
14081408
thread_safe
14091409
public_suffix (4.0.7)
14101410
racc (1.8.1)
1411-
rack (2.2.11)
1411+
rack (2.2.9)
14121412
rack-mini-profiler (2.3.1)
14131413
rack (>= 1.2.0)
14141414
rack-robustness (1.1.0)
@@ -1459,7 +1459,7 @@ GEM
14591459
http-cookie (>= 1.0.2, < 2.0)
14601460
mime-types (>= 1.16, < 4.0)
14611461
netrc (~> 0.8)
1462-
rexml (3.3.9)
1462+
rexml (3.3.8)
14631463
rjb (1.6.4)
14641464
rotp (6.3.0)
14651465
rqrcode (2.2.0)
@@ -1542,7 +1542,7 @@ GEM
15421542
thread_safe (0.3.6)
15431543
tilt (2.0.10)
15441544
timecop (0.9.4)
1545-
timeout (0.4.3)
1545+
timeout (0.4.1)
15461546
twilio-ruby (5.52.0)
15471547
faraday (>= 0.9, < 2.0)
15481548
jwt (>= 1.5, <= 2.5)
@@ -1615,19 +1615,16 @@ DEPENDENCIES
16151615
listen
16161616
mechanize
16171617
mysql2
1618-
net-imap (= 0.3.8)
16191618
nokogiri
16201619
paperclip
16211620
passenger (= 5.3.7)
1622-
rack (= 2.2.11)
16231621
rack-mini-profiler
16241622
rack-robustness
16251623
rails (= 5.2.8.1)
16261624
rails-controller-testing
16271625
rails-i18n
16281626
rake
16291627
rest-client
1630-
rexml (= 3.3.9)
16311628
rr
16321629
rspec-activemodel-mocks
16331630
rspec-collection_matchers

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def strict_transport_security
6565
def authenticate_everything
6666
authenticate_or_request_with_http_basic("Rocky") do |user, password|
6767
pass = Settings.admin_password
68-
pass.present? && user == 'rtvdemo' && password == 'roxy'
68+
pass.present? && user == 'rtvdemo' && password == 'sunset'
6969
end
7070
end
7171

app/controllers/state_configurations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def submit_data(file)
5151
def authenticate
5252
authenticate_or_request_with_http_basic("Settings UI") do |user, password|
5353
pass = Settings.admin_password
54-
pass.present? && user == 'rtvdemo' && password == 'roxy'
54+
pass.present? && user == 'rtvdemo' && password == 'sunset'
5555
end
5656
end
5757

app/controllers/step2_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def render_show
3434
end
3535

3636

37-
def update
37+
def update
3838
# get rid of home_state_name
3939
if params[:registrant]
4040
params[:registrant].delete(:home_state_name)

app/helpers/date_of_birth_methods.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
module DateOfBirthMethods
22
def date_of_birth=(string_value)
3+
# If the date is "00/00/0000", set it directly
4+
if string_value == "00/00/0000"
5+
write_attribute(:date_of_birth, nil)
6+
return
7+
end
8+
39
dob = nil
410
if string_value.is_a?(String)
511
if matches = string_value.match(/\A(\d{1,2})\D+(\d{1,2})\D+(\d{4})\z/)
@@ -77,9 +83,8 @@ def form_date_of_birth
7783
end
7884
end
7985

80-
# TODO: remove duplicate from RegistrantAbrMethods
8186
def validate_date_of_birth_age
82-
if date_of_birth.present?
87+
if date_of_birth.present? && date_of_birth != "00/00/0000"
8388
age_in_years = (Date.today - date_of_birth).to_i / 365
8489
if age_in_years < 13
8590
errors.add(:date_of_birth, :way_too_young)
@@ -94,8 +99,13 @@ def validate_date_of_birth_age
9499
end
95100
end
96101

97-
# TODO: remove duplicate from RegistrantAbrMethods
98102
def validate_date_of_birth
103+
# Skip validation if the date_of_birth is "00/00/0000"
104+
if date_of_birth == "00/00/0000" || date_of_birth.nil?
105+
self[:date_of_birth] = nil # Explicitly set it to nil if it's "00/00/0000"
106+
return
107+
end
108+
99109
if date_of_birth_before_type_cast.is_a?(Date) || date_of_birth_before_type_cast.is_a?(Time)
100110
validate_date_of_birth_age
101111
return

app/models/registrant.rb

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,23 @@ def pdf_date_of_birth_year
785785
pdf_date_of_birth.split('/')[2]
786786
end
787787

788+
#def pdf_date_of_birth
789+
# (date_of_birth.is_a?(Date) || date_of_birth.is_a?(DateTime)) ? date_of_birth.to_s(:month_day_year) : date_of_birth.to_s
790+
#end
791+
788792
def pdf_date_of_birth
789-
(date_of_birth.is_a?(Date) || date_of_birth.is_a?(DateTime)) ? date_of_birth.to_s(:month_day_year) : date_of_birth.to_s
793+
if home_state_abbrev == "NC"
794+
"00/00/0000"
795+
else
796+
(date_of_birth.is_a?(Date) || date_of_birth.is_a?(DateTime)) ? date_of_birth.to_s(:month_day_year) : date_of_birth.to_s
797+
end
790798
end
791799

800+
validate :must_be_18_by_election_for_nc
801+
802+
validate :date_of_birth_required_for_states
803+
804+
792805
def pdf_english_race
793806
if race != I18n.t('txt.registration.races', :locale=>locale).values.last
794807
english_race
@@ -2168,5 +2181,20 @@ def limit_zip_codes
21682181
end
21692182
end
21702183
end
2171-
2184+
2185+
# This method checks if the registrant's home state is NC,
2186+
# and enforces that the "will_be_18_by_election" field must be true
2187+
def must_be_18_by_election_for_nc
2188+
if home_state_abbrev == "NC" && at_least_step_2? && !will_be_18_by_election
2189+
errors.add(:will_be_18_by_election, I18n.t('activerecord.errors.models.registrant.attributes.will_be_18_by_election.accepted'))
2190+
end
2191+
end
2192+
2193+
def date_of_birth_required_for_states
2194+
# Only validate if the registrant is at Step 2 or beyond
2195+
if status.to_s.match?(/step_[2-5]|complete/) && home_state_abbrev != "NC" && date_of_birth.nil?
2196+
errors.add(:date_of_birth, I18n.t('activerecord.errors.models.registrant.blank'))
2197+
end
2198+
end
2199+
21722200
end

app/models/state_registrants/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def english_name_suffix
9797

9898

9999
def check_locale_change
100-
if !self.new_locale.blank? && self.new_locale != self.locale && ENABLED_LOCALES.include?(self.new_locale)
100+
if !self.new_locale.blank? && self.new_locale != self.locale
101101
selected_name_title_key = name_title_key
102102
selected_name_suf_key = name_suffix_key
103103
selected_race_key = race_key

app/views/catalist_lookups/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ $(document).ready(function() {
9393
<%= render :partial=> "registrants/phone_opt_ins", :locals=>{:form=>form} %>
9494
</fieldset>
9595

96-
<%= rollover_button(:next_step, I18n.t('txt.button.lookup').html_safe) %>
96+
<%= rollover_button(:next_step, I18n.t(params[:utm_feature] == 'prereg_included' ? 'txt.button.lookup_pre_register' : 'txt.button.lookup').html_safe) %>
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
%h1{role: "heading", "aria-level": 1}= t('txt.lookup.step_1_header')
1+
- header_key = params[:utm_feature] == 'prereg_included' ? 'txt.lookup.step_1_header_pre_register' : 'txt.lookup.step_1_header'
2+
%h1{role: "heading", "aria-level": 1}= t(header_key)
23
4+
- intro_key = params[:utm_feature] == 'prereg_included' ? 'txt.lookup.step_1_instructions_pre_register' : 'txt.lookup.step_1_instructions'
35
.intro-message
4-
= t('txt.lookup.step_1_instructions').html_safe
6+
= t(intro_key).html_safe
57
68
= form_for(@lookup) do |form|
79
= render partial: 'form', :object => form
8-
910
%p= I18n.t('txt.privacy_policy_acceptance').html_safe

0 commit comments

Comments
 (0)