mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-20 05:21:27 +00:00
commit
310025ad90
1 changed files with 22 additions and 11 deletions
|
@ -314,16 +314,20 @@ class ApiV1Dot1Controller extends Controller
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
abort_if(!$user, 403);
|
abort_if(!$user, 403);
|
||||||
abort_if($user->status != null, 403);
|
abort_if($user->status != null, 403);
|
||||||
|
$from = config('mail.from.address');
|
||||||
|
|
||||||
$emailVerifications = EmailVerification::whereUserId($user->id)
|
$emailVerifications = EmailVerification::whereUserId($user->id)
|
||||||
->orderByDesc('id')
|
->orderByDesc('id')
|
||||||
->where('created_at', '>', now()->subDays(14))
|
->where('created_at', '>', now()->subDays(14))
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->get()
|
->get()
|
||||||
->map(function($mail) {
|
->map(function($mail) use($user, $from) {
|
||||||
return [
|
return [
|
||||||
'type' => 'Email Verification',
|
'type' => 'Email Verification',
|
||||||
'created_at' => $mail->created_at->format('c')
|
'subject' => 'Confirm Email',
|
||||||
|
'to_address' => $user->email,
|
||||||
|
'from_address' => $from,
|
||||||
|
'created_at' => str_replace('@', 'at', $mail->created_at->format('M j, Y @ g:i:s A'))
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
@ -334,10 +338,13 @@ class ApiV1Dot1Controller extends Controller
|
||||||
->orderByDesc('created_at')
|
->orderByDesc('created_at')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->get()
|
->get()
|
||||||
->map(function($mail) {
|
->map(function($mail) use($user, $from) {
|
||||||
return [
|
return [
|
||||||
'type' => 'Password Reset',
|
'type' => 'Password Reset',
|
||||||
'created_at' => now()->parse($mail->created_at)->format('c')
|
'subject' => 'Reset Password Notification',
|
||||||
|
'to_address' => $user->email,
|
||||||
|
'from_address' => $from,
|
||||||
|
'created_at' => str_replace('@', 'at', now()->parse($mail->created_at)->format('M j, Y @ g:i:s A'))
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
@ -348,19 +355,23 @@ class ApiV1Dot1Controller extends Controller
|
||||||
->orderByDesc('created_at')
|
->orderByDesc('created_at')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->get()
|
->get()
|
||||||
->map(function($mail) {
|
->map(function($mail) use($user, $from) {
|
||||||
return [
|
return [
|
||||||
'type' => 'Password Change',
|
'type' => 'Password Change',
|
||||||
'created_at' => $mail->created_at
|
'subject' => 'Password Change',
|
||||||
|
'to_address' => $user->email,
|
||||||
|
'from_address' => $from,
|
||||||
|
'created_at' => str_replace('@', 'at', now()->parse($mail->created_at)->format('M j, Y @ g:i:s A'))
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
$res = [
|
$res = collect([])
|
||||||
'email_verifications' => $emailVerifications,
|
->merge($emailVerifications)
|
||||||
'password_resets' => $passwordResets,
|
->merge($passwordResets)
|
||||||
'password_changes' => $passwordChanges
|
->merge($passwordChanges)
|
||||||
];
|
->sortByDesc('created_at')
|
||||||
|
->values();
|
||||||
|
|
||||||
return $this->json($res);
|
return $this->json($res);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue