updates and cleanup.

This commit is contained in:
2026-09-24 18:49:34 +01:00
parent 1e27d7629f
commit 8823fa808a
9 changed files with 115 additions and 71 deletions
+45 -2
View File
@@ -51,9 +51,9 @@ module Players
Logman.log "Pass req: #{email} & #{code}"
true
send_email(:pass_req, email, code)
true
end
def self.pass_reset(pass, code)
@@ -90,6 +90,49 @@ module Players
player && player[:activation_code] == "!"
end
def self.send_email(type, email, *args)
case type
when :new
username, code = args
Mail.send(
email,
"Verify your InfinSweeper account",
<<~HTML
<h2>Welcome to InfinSweeper, #{ERB::Util.html_escape(username)}!</h2>
<p>Thanks for signing up.</p>
<p>
Please verify your email by clicking
<a href="https://your-domain.com/verify/#{ERB::Util.url_encode(code)}">
this link
</a>.
</p>
HTML
)
when :pass_req
code = args.first
Mail.send(
email,
"Reset your InfinSweeper password",
<<~HTML
<h2>Password reset</h2>
<p>You requested a password reset for your InfinSweeper account.</p>
<p>
<a href="https://your-domain.com/reset_password/#{ERB::Util.url_encode(code)}">
Click here to reset your password
</a>
</p>
<p>If you didn't request this, you can safely ignore this email.</p>
HTML
)
else
raise ArgumentError, "Unknown email type: #{type.inspect}"
end
end
Thread.new do
loop do
unverified.each do |player|