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
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

View file

@ -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"

View file

@ -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

View file

@ -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).