mirror of
https://github.com/neocities/neocities.git
synced 2025-07-03 01:23:22 +02:00
Mandate email validation for free accounts. Be sure to set EMAIL_VALIDATION_CUTOFF_DATE before deploy
This commit is contained in:
parent
cef1611003
commit
a2a6a40438
19 changed files with 178 additions and 27 deletions
|
@ -72,12 +72,19 @@ def encoding_fix(file)
|
|||
end
|
||||
|
||||
def send_confirmation_email(site=current_site)
|
||||
if site.email_confirmation_count > Site::MAXIMUM_EMAIL_CONFIRMATIONS
|
||||
flash[:error] = 'You sent too many email confirmation requests, cannot continue.'
|
||||
redirect request.referrer
|
||||
end
|
||||
|
||||
DB['UPDATE sites set email_confirmation_count=email_confirmation_count+1 WHERE id=?', site.id].first
|
||||
|
||||
EmailWorker.perform_async({
|
||||
from: 'web@neocities.org',
|
||||
reply_to: 'contact@neocities.org',
|
||||
to: site.email,
|
||||
subject: "[Neocities] Confirm your email address",
|
||||
body: Tilt.new('./views/templates/email_confirm.erb', pretty: true).render(self, site: site)
|
||||
body: Tilt.new('./views/templates/email/confirm.erb', pretty: true).render(self, site: site)
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -116,3 +123,7 @@ end
|
|||
def dont_browser_cache
|
||||
@dont_browser_cache = true
|
||||
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
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue