mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
enforce disposable email policy on email verifications / changes
This commit is contained in:
parent
2e5cc9b243
commit
0e3b6ee3a0
2 changed files with 4 additions and 1 deletions
|
@ -173,6 +173,8 @@ post '/site/create_directory' do
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/site/:username/confirm_email/:token' do
|
get '/site/:username/confirm_email/:token' do
|
||||||
|
@title = 'Confirm email'
|
||||||
|
|
||||||
if current_site && current_site.email_confirmed
|
if current_site && current_site.email_confirmed
|
||||||
return erb(:'site_email_confirmed')
|
return erb(:'site_email_confirmed')
|
||||||
end
|
end
|
||||||
|
@ -201,6 +203,7 @@ end
|
||||||
|
|
||||||
get '/site/:username/confirm_email' do
|
get '/site/:username/confirm_email' do
|
||||||
require_login
|
require_login
|
||||||
|
@title = 'Confirm your Email Address'
|
||||||
@fromsettings = session[:fromsettings]
|
@fromsettings = session[:fromsettings]
|
||||||
redirect '/' if current_site.username != params[:username] || !current_site.parent? || current_site.email_confirmed
|
redirect '/' if current_site.username != params[:username] || !current_site.parent? || current_site.email_confirmed
|
||||||
erb :'site/confirm_email'
|
erb :'site/confirm_email'
|
||||||
|
|
|
@ -912,7 +912,7 @@ class Site < Sequel::Model
|
||||||
errors.add :email, 'Cannot use this email address.'
|
errors.add :email, 'Cannot use this email address.'
|
||||||
end
|
end
|
||||||
|
|
||||||
if parent? && new? && self.class.disposable_email?(values[:email])
|
if parent? && (values[:created_at].nil? || values[:created_at] > 1.week.ago) && self.class.disposable_email?(values[:email])
|
||||||
errors.add :email, 'Cannot use a disposable email address.'
|
errors.add :email, 'Cannot use a disposable email address.'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue