mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-31 02:08:57 +00:00
Add function to delete users that have not verified their accounts for 3 or more days
This commit is contained in:
+11
-1
@@ -12,6 +12,7 @@ use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Jrean\UserVerification\Traits\UserVerification;
|
||||
|
||||
/**
|
||||
* App\Models\User.
|
||||
@@ -111,6 +112,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
use UserVerification;
|
||||
|
||||
public const ERR_SIGNUP_BADUNAME = -1;
|
||||
public const ERR_SIGNUP_BADPASS = -2;
|
||||
@@ -1033,7 +1035,7 @@ class User extends Authenticatable
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes old rows FROM the user_requests and user_downloads tables.
|
||||
* Deletes old rows FROM the user_requests and user_downloads tables.
|
||||
* if site->userdownloadpurgedays SET to 0 then all release history is removed but
|
||||
* the download/request rows must remain for at least one day to allow the role based
|
||||
* limits to apply.
|
||||
@@ -1050,4 +1052,12 @@ class User extends Authenticatable
|
||||
UserRequest::query()->where('timestamp', '<', now()->subDays($days))->delete();
|
||||
UserDownload::query()->where('timestamp', '<', now()->subDays($days))->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes users that have not verified their accounts for 3 or more days
|
||||
*/
|
||||
public static function deleteUnVerified()
|
||||
{
|
||||
static::query()->where('verified', '=', 0)->where('created_at', '<', now()->subDays(3))->delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user