This commit is contained in:
神楽坂 白 2023-11-11 05:50:41 +00:00
parent 1d24a03dd2
commit 16f3e526ba

View File

@ -71,10 +71,12 @@ function ($attribute, $value, $fail) {
try { try {
$key = Crypt::decryptString($key); $key = Crypt::decryptString($key);
$key = json_decode($key, true); $key = json_decode($key, true);
if (time() - $key['time'] < 300 && !empty($key['id'])) { if (!empty($key['id'])) {
$where[] = ['id', '>', $key['id']]; $where[] = ['id', '>', $key['id']];
} elseif (time() - $key['time'] < 300) {
$where[] = ['received_at', '>', Carbon::parse($key['time'])];
} else { } else {
$where[] = ['received_at', '>', Carbon::now()]; $where[] = ['received_at', '>', Carbon::now() - 60];
} }
} catch (\Throwable $th) { } catch (\Throwable $th) {
return abort(400); return abort(400);
@ -125,11 +127,14 @@ public function put(Request $request)
return abort(401); return abort(401);
} }
$to = strtolower($to);
$from = strtolower($from);
$mail = new Mail; $mail = new Mail;
$mail->from = $from; $mail->from = $from;
$mail->from_hash = hash('sha256', $from); $mail->from_hash = hash('sha256', $from);
$mail->to = strtolower($to); $mail->to = $to;
$mail->to_hash = hash('sha256', $to); $mail->to_hash = hash('sha256', $to);
$mail->title = $title; $mail->title = $title;