Set email validation grandfathering for May 16th. All new sites will need to validate email.

This commit is contained in:
Kyle Drake 2016-05-14 23:15:13 -04:00
parent a2a6a40438
commit f97ebd9781
4 changed files with 6 additions and 4 deletions

2
app.rb
View file

@ -28,7 +28,7 @@ before do
@api = true @api = true
content_type :json content_type :json
elsif request.path.match /^\/webhooks\// 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/) elsif email_not_validated? && !(request.path =~ /^\/site\/.+\/confirm_email|^\/settings\/change_email|^\/signout|^\/welcome|^\/plan/)
redirect "/site/#{current_site.username}/confirm_email" redirect "/site/#{current_site.username}/confirm_email"
else else

View file

@ -232,7 +232,7 @@ post '/site/:username/confirm_email' do
redirect '/settings#email' redirect '/settings#email'
end end
redirect '/' redirect '/tutorial'
else else
flash[:error] = 'You must enter a valid token.' flash[:error] = 'You must enter a valid token.'
redirect "/site/#{current_site.username}/confirm_email" redirect "/site/#{current_site.username}/confirm_email"

View file

@ -125,5 +125,7 @@ def dont_browser_cache
end end
def email_not_validated? 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 end

View file

@ -121,7 +121,7 @@ class Site < Sequel::Model
maximum_site_files: 2000 maximum_site_files: 2000
) )
EMAIL_VALIDATION_CUTOFF_DATE = Time.now - 1 EMAIL_VALIDATION_CUTOFF_DATE = Time.parse('May 16, 2016')
def self.newsletter_sites def self.newsletter_sites
Site.select(:email). Site.select(:email).