feat: send security lockout emails to all admin users
This commit is contained in:
@@ -35,8 +35,23 @@ export async function signIn(email: string, password: string) {
|
||||
.from('users')
|
||||
.update({ role: 'gesperrt' })
|
||||
.eq('email', email)
|
||||
// Notify admin
|
||||
await sendLockoutEmail('info@hephex.de')
|
||||
// Notify all admins
|
||||
try {
|
||||
const adminClient = createAdminClient()
|
||||
const { data: admins } = await adminClient
|
||||
.from('users')
|
||||
.select('email')
|
||||
.eq('role', 'admin')
|
||||
|
||||
if (admins && admins.length > 0) {
|
||||
const adminEmails = admins.map(a => a.email).filter(Boolean)
|
||||
for (const adminEmail of adminEmails) {
|
||||
await sendLockoutEmail(adminEmail)
|
||||
}
|
||||
}
|
||||
} catch (mailError) {
|
||||
console.error('Failed to notify admins of lockout:', mailError)
|
||||
}
|
||||
return { success: false, error: 'Konto gesperrt nach 5 Fehlversuchen.' }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user