fix for missing following code, email fixes, start on delete site

This commit is contained in:
Kyle Drake 2014-08-13 19:27:40 -07:00
parent 89998e2f18
commit 08026ac235
6 changed files with 54 additions and 10 deletions

17
app.rb
View file

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