mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 08:56:52 +01:00 
			
		
		
		
	* Fix button * Replace array with index * Fix Server ToggleInstallService * FiNodeVersionsCheck * Fix CreateWebhookConfiguration * Fixdatabasehost post_help > port_help * Fix User CreateServer * Fix Profile language_help * Fix Role permission UserResource * Remove debug & Pint
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Console\Commands\User;
 | 
						|
 | 
						|
use App\Models\User;
 | 
						|
use Illuminate\Console\Command;
 | 
						|
 | 
						|
class DisableTwoFactorCommand extends Command
 | 
						|
{
 | 
						|
    protected $description = 'Disable two-factor authentication for a specific user in the Panel.';
 | 
						|
 | 
						|
    protected $signature = 'p:user:disable2fa {--email= : The email of the user to disable 2-Factor for.}';
 | 
						|
 | 
						|
    /**
 | 
						|
     * Handle command execution process.
 | 
						|
     *
 | 
						|
     * @throws \App\Exceptions\Model\DataValidationException
 | 
						|
     */
 | 
						|
    public function handle(): void
 | 
						|
    {
 | 
						|
        if ($this->input->isInteractive()) {
 | 
						|
            $this->output->warning(trans('command/messages.user.2fa_help_text.0') . trans('command/messages.user.2fa_help_text.1'));
 | 
						|
        }
 | 
						|
 | 
						|
        $email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_email'));
 | 
						|
 | 
						|
        $user = User::query()->where('email', $email)->firstOrFail();
 | 
						|
        $user->use_totp = false;
 | 
						|
        $user->totp_secret = null;
 | 
						|
        $user->save();
 | 
						|
 | 
						|
        $this->info(trans('command/messages.user.2fa_disabled', ['email' => $user->email]));
 | 
						|
    }
 | 
						|
}
 |