mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
moar fixes
This commit is contained in:
parent
0bdc09f840
commit
748e27120f
1 changed files with 6 additions and 4 deletions
10
app.rb
10
app.rb
|
@ -435,11 +435,13 @@ get '/password_reset' do
|
||||||
end
|
end
|
||||||
|
|
||||||
post '/send_password_reset' do
|
post '/send_password_reset' do
|
||||||
site = Site[email: params[:email]]
|
sites = Site.filter(email: params[:email]).all
|
||||||
|
|
||||||
if site
|
if sites.length > 0
|
||||||
token = SecureRandom.uuid.gsub('-', '')
|
token = SecureRandom.uuid.gsub('-', '')
|
||||||
site.update password_reset_token: token
|
sites.each do |site|
|
||||||
|
site.update password_reset_token: token
|
||||||
|
end
|
||||||
|
|
||||||
body = <<-EOT
|
body = <<-EOT
|
||||||
Hello! This is the NeoCities cat, and I have received a password reset request for your e-mail address. Purrrr.
|
Hello! This is the NeoCities cat, and I have received a password reset request for your e-mail address. Purrrr.
|
||||||
|
@ -473,7 +475,7 @@ end
|
||||||
get '/password_reset_confirm' do
|
get '/password_reset_confirm' do
|
||||||
sites = Site.filter(password_reset_token: params[:token]).all
|
sites = Site.filter(password_reset_token: params[:token]).all
|
||||||
|
|
||||||
if sites.length < 0
|
if sites.length > 0
|
||||||
sites.each do |site|
|
sites.each do |site|
|
||||||
site.password = params[:token]
|
site.password = params[:token]
|
||||||
site.save
|
site.save
|
||||||
|
|
Loading…
Add table
Reference in a new issue