mirror of
https://github.com/friendica/friendica
synced 2025-05-11 06:24:11 +02:00
old boot.php functions replaced in src/module (3)
This commit is contained in:
parent
83390d4b00
commit
ae6d67ed1f
22 changed files with 158 additions and 147 deletions
|
@ -54,12 +54,12 @@ class Verify extends BaseSettings
|
|||
|
||||
$this->pConfig = $pConfig;
|
||||
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$secret = $this->pConfig->get(local_user(), '2fa', 'secret');
|
||||
$verified = $this->pConfig->get(local_user(), '2fa', 'verified');
|
||||
$secret = $this->pConfig->get(Session::getLocalUser(), '2fa', 'secret');
|
||||
$verified = $this->pConfig->get(Session::getLocalUser(), '2fa', 'verified');
|
||||
|
||||
if ($secret && $verified) {
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
|
@ -73,7 +73,7 @@ class Verify extends BaseSettings
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -82,10 +82,10 @@ class Verify extends BaseSettings
|
|||
|
||||
$google2fa = new Google2FA();
|
||||
|
||||
$valid = $google2fa->verifyKey($this->pConfig->get(local_user(), '2fa', 'secret'), $_POST['verify_code'] ?? '');
|
||||
$valid = $google2fa->verifyKey($this->pConfig->get(Session::getLocalUser(), '2fa', 'secret'), $_POST['verify_code'] ?? '');
|
||||
|
||||
if ($valid) {
|
||||
$this->pConfig->set(local_user(), '2fa', 'verified', true);
|
||||
$this->pConfig->set(Session::getLocalUser(), '2fa', 'verified', true);
|
||||
DI::session()->set('2fa', true);
|
||||
|
||||
DI::sysmsg()->addInfo($this->t('Two-factor authentication successfully activated.'));
|
||||
|
@ -99,7 +99,7 @@ class Verify extends BaseSettings
|
|||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return Login::form('settings/2fa/verify');
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ class Verify extends BaseSettings
|
|||
|
||||
$company = 'Friendica';
|
||||
$holder = DI::session()->get('my_address');
|
||||
$secret = $this->pConfig->get(local_user(), '2fa', 'secret');
|
||||
$secret = $this->pConfig->get(Session::getLocalUser(), '2fa', 'secret');
|
||||
|
||||
$otpauthUrl = (new Google2FA())->getQRCodeUrl($company, $holder, $secret);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue