mirror of
https://github.com/neocities/neocities.git
synced 2025-07-21 18:16:07 +02:00
fix for missing following code, email fixes, start on delete site
This commit is contained in:
parent
89998e2f18
commit
08026ac235
6 changed files with 54 additions and 10 deletions
17
app.rb
17
app.rb
|
@ -85,7 +85,7 @@ get '/site/:username.rss' do |username|
|
|||
site.to_rss.to_xml
|
||||
end
|
||||
|
||||
get '/site/:username' do |username|
|
||||
get '/site/:username/?' do |username|
|
||||
site = Site[username: username]
|
||||
not_found if site.nil?
|
||||
if current_site && (site.is_blocking?(current_site) || current_site.is_blocking?(site))
|
||||
|
@ -531,6 +531,11 @@ post '/change_email' do
|
|||
current_site.email_confirmation_token = SecureRandom.hex 3
|
||||
current_site.email_confirmed = false
|
||||
|
||||
if params[:email] == current_site.email
|
||||
current_site.errors.add :email, 'You are already using this email address for this account.'
|
||||
halt erb(:settings)
|
||||
end
|
||||
|
||||
if current_site.valid?
|
||||
current_site.save_changes
|
||||
send_confirmation_email
|
||||
|
@ -1146,6 +1151,16 @@ post '/site/:username/block' do |username|
|
|||
end
|
||||
end
|
||||
|
||||
post '/site/delete' do
|
||||
require_login
|
||||
if current_site.username != params[:username]
|
||||
errors.add :username, 'Could not delete site, site name did not match.'
|
||||
halt erb(:settings)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def require_admin
|
||||
redirect '/' unless signed_in? && current_site.is_admin
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue