mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.3 KiB
PHTML
62 lines
1.3 KiB
PHTML
|
4 years ago
|
<?php
|
||
|
|
|
||
|
4 weeks ago
|
namespace App\Console\Commands\User;
|
||
|
4 years ago
|
|
||
|
4 weeks ago
|
use App\Models\User;
|
||
|
9 months ago
|
use Illuminate\Console\Command;
|
||
|
2 years ago
|
use Illuminate\Contracts\Console\PromptsForMissingInput;
|
||
|
4 years ago
|
|
||
|
2 years ago
|
class UserVerifyEmail extends Command implements PromptsForMissingInput
|
||
|
4 years ago
|
{
|
||
|
|
/**
|
||
|
|
* The name and signature of the console command.
|
||
|
|
*
|
||
|
|
* @var string
|
||
|
|
*/
|
||
|
|
protected $signature = 'user:verifyemail {username}';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The console command description.
|
||
|
|
*
|
||
|
|
* @var string
|
||
|
|
*/
|
||
|
|
protected $description = 'Verify user email address';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Create a new command instance.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function __construct()
|
||
|
|
{
|
||
|
|
parent::__construct();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Execute the console command.
|
||
|
|
*
|
||
|
|
* @return mixed
|
||
|
|
*/
|
||
|
|
public function handle()
|
||
|
|
{
|
||
|
2 years ago
|
$username = $this->argument('username');
|
||
|
|
$user = User::whereUsername($username)->first();
|
||
|
4 years ago
|
|
||
|
9 months ago
|
if (! $user) {
|
||
|
4 years ago
|
$this->error('Username not found');
|
||
|
9 months ago
|
|
||
|
4 years ago
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
9 months ago
|
if ($user->email_verified_at) {
|
||
|
|
$this->error('Email already verified '.$user->email_verified_at->diffForHumans());
|
||
|
|
|
||
|
2 years ago
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
4 years ago
|
$user->email_verified_at = now();
|
||
|
|
$user->save();
|
||
|
9 months ago
|
$this->info('Successfully verified email address for '.$user->username);
|
||
|
4 years ago
|
}
|
||
|
|
}
|