Skip to content

Commit

Permalink
Enhance rate limiting in ConnectionsController by adding email-based …
Browse files Browse the repository at this point in the history
…identification; simplify mailer layout by removing unnecessary links and improving structure.
  • Loading branch information
mpressen committed Nov 23, 2024
1 parent fd3cd6b commit 99334ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
1 change: 1 addition & 0 deletions app/controllers/connections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ConnectionsController < ApplicationController
}
rate_limit to: 1,
within: 1.minute,
by: -> { params[:email] },
only: :resend_otp,
with: -> {
redirect_to new_connection_path,
Expand Down
35 changes: 7 additions & 28 deletions app/views/layouts/mailer.html.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
<!DOCTYPE html>
<html lang="en" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta charset="utf-8">
<meta name="x-apple-disable-message-reformatting">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">
<!--[if mso]>
<noscript>
<xml>
<o:OfficeDocumentSettings xmlns:o="urn:schemas-microsoft-com:office:office">
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<style><!DOCTYPE html>
<html lang="en" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta charset="utf-8">
<meta name="x-apple-disable-message-reformatting">
Expand Down Expand Up @@ -68,19 +51,15 @@
<table style="width: auto" cellpadding="0" cellspacing="0" role="none">
<tr>
<td style="padding-right: 8px; vertical-align: middle">
<a href="https://benefactorum.org">
<img src="<%= vite_asset_path('assets/logo.svg') %>" alt="logo de Benefactorum" style="max-width: 100%; vertical-align: middle; height: 48px; width: 48px" width="48" height="48">
</a>
<img src="<%= vite_asset_url('assets/logo.svg') %>" alt="logo de Benefactorum" style="max-width: 100%; vertical-align: middle; height: 48px; width: 48px" width="48" height="48">
</td>
<td style="text-align: right; vertical-align: middle">
<a href="https://benefactorum.org" style="font-family: Montserrat, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; text-decoration: none">
<h1 style="margin: 0; font-size: 30px; font-weight: 700; line-height: 1; color: hsl(180 100% 10%)">
Benefactorum
</h1>
<h2 style="margin: 0; font-size: 14px; line-height: 1; color: #475569">
Association de bienfaiteurs
</h2>
</a>
<h1 style="margin: 0; font-size: 30px; font-weight: 700; line-height: 1; color: hsl(180 100% 10%)">
Benefactorum
</h1>
<h2 style="margin: 0; font-size: 14px; line-height: 1; color: #475569">
Association de bienfaiteurs
</h2>
</td>
</tr>
</table>
Expand Down

0 comments on commit 99334ce

Please sign in to comment.