mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
fix password reset, fix ip blocker, turn off js for now
This commit is contained in:
parent
6245319bc1
commit
93f7918340
4 changed files with 21 additions and 8 deletions
6
app.rb
6
app.rb
|
@ -344,7 +344,7 @@ post '/admin/banhammer' do
|
||||||
}
|
}
|
||||||
|
|
||||||
if !['127.0.0.1', nil, ''].include? site.ip
|
if !['127.0.0.1', nil, ''].include? site.ip
|
||||||
`sudo ufw deny from #{site.ip}`
|
`sudo ufw insert 1 deny from #{site.ip}`
|
||||||
end
|
end
|
||||||
|
|
||||||
flash[:success] = 'MISSION ACCOMPLISHED'
|
flash[:success] = 'MISSION ACCOMPLISHED'
|
||||||
|
@ -404,10 +404,10 @@ the NeoCities Cat
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/password_reset_confirm' do
|
get '/password_reset_confirm' do
|
||||||
site = Site[password_reset_token: params[:token]]
|
site = Site[password_reset_token: params[:code]]
|
||||||
|
|
||||||
if site
|
if site
|
||||||
site.password = params[:token]
|
site.password = params[:code]
|
||||||
site.save
|
site.save
|
||||||
|
|
||||||
flash[:success] = 'Your password has been changed to the token sent in your e-mail. Please login and change your password in the settings page as soon as possible.'
|
flash[:success] = 'Your password has been changed to the token sent in your e-mail. Please login and change your password in the settings page as soon as possible.'
|
||||||
|
|
|
@ -55,6 +55,19 @@ if ENV['RACK_ENV'] == 'development' && Server.count == 0
|
||||||
Server.create ip: '127.0.0.1', slots_available: 999999
|
Server.create ip: '127.0.0.1', slots_available: 999999
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Mail.defaults do
|
||||||
|
#options = { :address => "smtp.gmail.com",
|
||||||
|
# :port => 587,
|
||||||
|
# :domain => 'your.host.name',
|
||||||
|
# :user_name => '<username>',
|
||||||
|
# :password => '<password>',
|
||||||
|
# :authentication => 'plain',
|
||||||
|
# :enable_starttls_auto => true }
|
||||||
|
|
||||||
|
options = {}
|
||||||
|
delivery_method :sendmail, options
|
||||||
|
end
|
||||||
|
|
||||||
class Sinatra::Base
|
class Sinatra::Base
|
||||||
alias_method :render_original, :render
|
alias_method :render_original, :render
|
||||||
def render(engine, data, options = {}, locals = {}, &block)
|
def render(engine, data, options = {}, locals = {}, &block)
|
||||||
|
|
|
@ -4,10 +4,10 @@ class EmailWorker
|
||||||
|
|
||||||
def perform(args={})
|
def perform(args={})
|
||||||
Mail.deliver do
|
Mail.deliver do
|
||||||
from args[:from]
|
from args['from']
|
||||||
to args[:to]
|
to args['to']
|
||||||
subject args[:subject]
|
subject args['subject']
|
||||||
body args[:body]
|
body args['body']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class ScreenshotWorker
|
||||||
screenshot = Tempfile.new 'neocities_screenshot'
|
screenshot = Tempfile.new 'neocities_screenshot'
|
||||||
screenshot.close
|
screenshot.close
|
||||||
|
|
||||||
caps = Selenium::WebDriver::Remote::Capabilities.htmlunit javascript_enabled: true, takesScreenshot: true
|
caps = Selenium::WebDriver::Remote::Capabilities.htmlunit javascript_enabled: false, takesScreenshot: true
|
||||||
|
|
||||||
driver = Selenium::WebDriver.for :remote, url: $config['phantomjs_url'][rand($config['phantomjs_url'].length)], desired_capabilities: caps
|
driver = Selenium::WebDriver.for :remote, url: $config['phantomjs_url'][rand($config['phantomjs_url'].length)], desired_capabilities: caps
|
||||||
driver.manage.window.resize_to 1280, 720
|
driver.manage.window.resize_to 1280, 720
|
||||||
|
|
Loading…
Add table
Reference in a new issue