Skip to content

Commit 43a33c7

Browse files
fix(#418): solving unusual suspicious email
1 parent ba775e7 commit 43a33c7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/helpers/logintracker.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { sendEmail } from '../utils/sendEmail'
33

44
export const checkloginAttepmts = async (Profile: any, user: any) => {
55
try {
6-
const { activity } = await Profile.findOne({ user })
6+
const profile = await Profile.findOne({ user })
7+
8+
if(!profile || !profile.activity){
9+
return;
10+
}
11+
const { activity } = profile
12+
713
if (activity && activity?.length > 1) {
814
const inline = activity[activity.length - 1]
915
const recent = Number(inline.failed) + 1 || 0
@@ -13,7 +19,7 @@ export const checkloginAttepmts = async (Profile: any, user: any) => {
1319
) {
1420
await sendEmail(
1521
user.email,
16-
'SUSPICIOUS ACTIVITY DETECTED ON YOUR ACCOUNT',
22+
'ALERT: Unusual Activity on Your Account!',
1723
emailtemp(recent, inline.date, inline.country_name, inline.city),
1824
'',
1925
process.env.COORDINATOR_EMAIL,
@@ -102,9 +108,9 @@ const emailtemp = (trials: any, date: any, country: any, city: any) => {
102108
</head>
103109
<body>
104110
<div class="container">
105-
<h1>Suspicious Activity Detected</h1>
106-
<p>We have detected some suspicious activity on your account. For your security, we recommend taking immediate action to ensure the safety of your account.</p>
107-
<p>If you believe this activity was unauthorized, please click the button below to reset your password:</p>
111+
<h1>Important: Unusual Activity Detected</h1>
112+
<p>we have detected an unsual failed login attempts on your account</p>
113+
<p>If you believe this activity was unauthorized, we advise you to reset your password:</p>
108114
<a class="cta-button" href="${process.env.FRONTEND_LINK}/reset-password">Reset Password</a>
109115
<div id="det">
110116
@@ -115,8 +121,8 @@ const emailtemp = (trials: any, date: any, country: any, city: any) => {
115121
</div>
116122
117123
118-
<p>If you recognize this activity and believe it was performed by you, you can safely ignore this message.</p>
119-
<p>If you have any questions or need further assistance, please contact our support team.</p>
124+
<p>If the activity was performed by you, ignore this message.</p>
125+
<p class="note">Your security is our priority. Contact support if you need assistance.</p>
120126
<p>Best regards,</p>
121127
<p>Pulse Team</p>
122128
</div>

0 commit comments

Comments
 (0)