fixes to password reset

This commit is contained in:
Kyle Drake 2013-07-12 06:12:48 +02:00
parent 82195a9cb8
commit 6245319bc1
2 changed files with 4 additions and 2 deletions

4
app.rb
View file

@ -375,9 +375,8 @@ post '/send_password_reset' do
site = Site[email: params[:email]] site = Site[email: params[:email]]
if site if site
site.update password_reset_token: token
token = SecureRandom.uuid.gsub('-', '') token = SecureRandom.uuid.gsub('-', '')
site.update password_reset_token: token
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.
@ -393,6 +392,7 @@ the NeoCities Cat
body.strip! body.strip!
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org',
to: params[:email], to: params[:email],
subject: '[NeoCities] Password Reset', subject: '[NeoCities] Password Reset',
body: body body: body

View file

@ -1,8 +1,10 @@
class EmailWorker class EmailWorker
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options queue: :emails, retry: 10, backtrace: true
def perform(args={}) def perform(args={})
Mail.deliver do Mail.deliver do
from args[:from]
to args[:to] to args[:to]
subject args[:subject] subject args[:subject]
body args[:body] body args[:body]