mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 07:08:19 +00:00
Move methods to traits.
This commit is contained in:
@@ -35,6 +35,7 @@ use FireflyIII\Http\Requests\ProfileFormRequest;
|
||||
use FireflyIII\Http\Requests\TokenFormRequest;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\CreateStuff;
|
||||
use FireflyIII\Support\Http\Controllers\RequestInformation;
|
||||
use FireflyIII\User;
|
||||
use Google2FA;
|
||||
@@ -42,9 +43,7 @@ use Hash;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Passport\ClientRepository;
|
||||
use Laravel\Passport\Passport;
|
||||
use Log;
|
||||
use phpseclib\Crypt\RSA;
|
||||
|
||||
/**
|
||||
* Class ProfileController.
|
||||
@@ -55,7 +54,7 @@ use phpseclib\Crypt\RSA;
|
||||
*/
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
use RequestInformation;
|
||||
use RequestInformation, CreateStuff;
|
||||
|
||||
/**
|
||||
* ProfileController constructor.
|
||||
@@ -442,27 +441,5 @@ class ProfileController extends Controller
|
||||
return redirect(route('login'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new RSA keys.
|
||||
*/
|
||||
protected function createOAuthKeys(): void // create stuff
|
||||
{
|
||||
$rsa = new RSA();
|
||||
$keys = $rsa->createKey(4096);
|
||||
|
||||
[$publicKey, $privateKey] = [
|
||||
Passport::keyPath('oauth-public.key'),
|
||||
Passport::keyPath('oauth-private.key'),
|
||||
];
|
||||
|
||||
if (file_exists($publicKey) || file_exists($privateKey)) {
|
||||
return;
|
||||
}
|
||||
// @codeCoverageIgnoreStart
|
||||
Log::alert('NO OAuth keys were found. They have been created.');
|
||||
|
||||
file_put_contents($publicKey, array_get($keys, 'publickey'));
|
||||
file_put_contents($privateKey, array_get($keys, 'privatekey'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user