mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
use username for site ban by ip
This commit is contained in:
parent
70d7c0a92f
commit
f7933061d4
2 changed files with 9 additions and 2 deletions
9
app.rb
9
app.rb
|
@ -410,7 +410,14 @@ end
|
|||
|
||||
post '/admin/banip' do
|
||||
require_admin
|
||||
sites = Site.filter(ip: params[:ip]).all
|
||||
site = Site[username: params[:username]]
|
||||
|
||||
if site.nil?
|
||||
flash[:error] = 'User not found'
|
||||
redirect '/admin'
|
||||
end
|
||||
|
||||
sites = Site.filter(ip: site.ip).all
|
||||
sites.each {|site| ban_site site.username}
|
||||
flash[:error] = "#{sites.length} sites have been banned."
|
||||
redirect '/admin'
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
form action="/admin/banip" method="POST"
|
||||
input name="csrf_token" type="hidden" value="#{csrf_token}"
|
||||
p Site Name:
|
||||
input type="text" name="ip" placeholder="3.1.33.7" autocapitalize="off" autocorrect="off"
|
||||
input type="text" name="username" placeholder="starbucksoffer" autocapitalize="off" autocorrect="off"
|
||||
br
|
||||
input.btn.btn-danger type="submit" value="Ban"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue