- Popup/banner quảng cáo cấu hình từ admin (loại, link, lịch hiển thị) - Đặt lại mật khẩu: token 80 ký tự kèm check digit Luhn thay cho token+email lộ trong URL, chỉ lưu bản băm, một lần dùng, hết hạn 60 phút - Xác thực 2 lớp qua email khi đăng nhập (mã 6 số, ghi nhớ thiết bị 90 ngày) - ApiAuthCheck chặn ngay tài khoản bị khoá dù JWT còn hạn (trước đây dùng được tới hết TTL) - Handler trả 404 thay vì 500 khi ModelNotFoundException không bọc HttpException - Test ClientTamperingTest: xác nhận IDOR/giả mạo dữ liệu từ client đều bị chặn Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
26 lines
576 B
PHP
26 lines
576 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class CustomerTrustedDevice extends Model
|
|
{
|
|
protected $fillable = ['customer_id', 'token_hash', 'user_agent', 'ip_address', 'last_used_at', 'expires_at'];
|
|
|
|
protected $hidden = ['token_hash'];
|
|
|
|
protected $casts = [
|
|
'last_used_at' => 'datetime',
|
|
'expires_at' => 'datetime',
|
|
];
|
|
|
|
public function scopeActive(Builder $query): Builder
|
|
{
|
|
return $query->where('expires_at', '>', now());
|
|
}
|
|
}
|