Merge pull request #4636 from ladybirdweb/analysis-GD4LK2
Apply fixes from StyleCI
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
//classes
|
||||
use Illuminate\Console\Command;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Artisan;
|
||||
use File;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Encryption\Encrypter;
|
||||
//Models
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\User;
|
||||
use Artisan;
|
||||
use Exception;
|
||||
use File;
|
||||
use Hash;
|
||||
use Illuminate\Console\Command;
|
||||
//Models
|
||||
use Illuminate\Encryption\Encrypter;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SecureFaveoAPPKey extends Command
|
||||
{
|
||||
@@ -30,7 +31,6 @@ class SecureFaveoAPPKey extends Command
|
||||
protected $description = 'Command updates the APP_KEY of the system keeping encrypted data intact with new key to make it easy for users to secure their app for old sahred key. Admin credentials are required to run this command successfully.';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $email = [];
|
||||
@@ -55,7 +55,7 @@ class SecureFaveoAPPKey extends Command
|
||||
$username = $this->ask('Enter admin account username');
|
||||
$password = $this->secret('Enter admin account password');
|
||||
if (!$username || !$password) {
|
||||
throw new Exception("Username and password are required.", 1);
|
||||
throw new Exception('Username and password are required.', 1);
|
||||
}
|
||||
if (!Hash::check($password, User::where('user_name', $username)->value('password'))) {
|
||||
throw new Exception('We do not recognize you, make sure the username or password you provided are correct.', 1);
|
||||
@@ -77,7 +77,7 @@ class SecureFaveoAPPKey extends Command
|
||||
|
||||
/**
|
||||
* Function adds APP_KEY and generate new application key if does not
|
||||
* exist in .env
|
||||
* exist in .env.
|
||||
*
|
||||
* This method also updates the email passwords after new key generation
|
||||
* so that the imap/smtp does not stop working after update
|
||||
@@ -110,7 +110,7 @@ class SecureFaveoAPPKey extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Function checks if given $key exist in $envContent string
|
||||
* Function checks if given $key exist in $envContent string.
|
||||
*
|
||||
* @param string $envContent
|
||||
* @param string $key
|
||||
@@ -123,7 +123,7 @@ class SecureFaveoAPPKey extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Function stores all emails and their passwords as key => value in $emails prop
|
||||
* Function stores all emails and their passwords as key => value in $emails prop.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -133,7 +133,7 @@ class SecureFaveoAPPKey extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Function updates all emails's password
|
||||
* Function updates all emails's password.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -141,7 +141,7 @@ class SecureFaveoAPPKey extends Command
|
||||
{
|
||||
foreach ($this->emails as $email => $password) {
|
||||
Emails::where('email_address', $email)->update([
|
||||
'password' => $encrypter->encrypt($password)
|
||||
'password' => $encrypter->encrypt($password),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -150,9 +150,10 @@ class SecureFaveoAPPKey extends Command
|
||||
* Extract the encryption key from the given configuration.
|
||||
*
|
||||
* @param array $config
|
||||
* @return string
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function key()
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@ class Kernel extends ConsoleKernel
|
||||
\App\Console\Commands\Install::class,
|
||||
\App\Console\Commands\InstallDB::class,
|
||||
\App\Console\Commands\SetupTestEnv::class,
|
||||
\App\Console\Commands\SecureFaveoAPPKey::class
|
||||
\App\Console\Commands\SecureFaveoAPPKey::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user