From f97ebd97816e9693c8765fb41f69d4488c2f458a Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Sat, 14 May 2016 23:15:13 -0400 Subject: [PATCH] Set email validation grandfathering for May 16th. All new sites will need to validate email. --- app.rb | 2 +- app/site.rb | 2 +- app_helpers.rb | 4 +++- models/site.rb | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app.rb b/app.rb index f1298dc6..d73ba5d1 100644 --- a/app.rb +++ b/app.rb @@ -28,7 +28,7 @@ before do @api = true content_type :json elsif request.path.match /^\/webhooks\// - # Skips the CSRF check for stripe web hooks + # Skips the CSRF/validation check for stripe web hooks elsif email_not_validated? && !(request.path =~ /^\/site\/.+\/confirm_email|^\/settings\/change_email|^\/signout|^\/welcome|^\/plan/) redirect "/site/#{current_site.username}/confirm_email" else diff --git a/app/site.rb b/app/site.rb index 8249504c..a6d0e397 100644 --- a/app/site.rb +++ b/app/site.rb @@ -232,7 +232,7 @@ post '/site/:username/confirm_email' do redirect '/settings#email' end - redirect '/' + redirect '/tutorial' else flash[:error] = 'You must enter a valid token.' redirect "/site/#{current_site.username}/confirm_email" diff --git a/app_helpers.rb b/app_helpers.rb index 85ddba38..f564e730 100644 --- a/app_helpers.rb +++ b/app_helpers.rb @@ -125,5 +125,7 @@ def dont_browser_cache end def email_not_validated? - current_site && current_site.parent? && !current_site.is_education && !current_site.email_confirmed && !current_site.supporter? && Site::EMAIL_VALIDATION_CUTOFF_DATE < Time.now + return false if current_site && current_site.created_at < Site::EMAIL_VALIDATION_CUTOFF_DATE + + current_site && current_site.parent? && !current_site.is_education && !current_site.email_confirmed && !current_site.supporter? end diff --git a/models/site.rb b/models/site.rb index b0838f24..5405d5b6 100644 --- a/models/site.rb +++ b/models/site.rb @@ -121,7 +121,7 @@ class Site < Sequel::Model maximum_site_files: 2000 ) - EMAIL_VALIDATION_CUTOFF_DATE = Time.now - 1 + EMAIL_VALIDATION_CUTOFF_DATE = Time.parse('May 16, 2016') def self.newsletter_sites Site.select(:email).