mirror of
https://github.com/friendica/friendica
synced 2025-04-19 07:10:11 +00:00
Replace deprecated defaults() calls by ?? and ?: operators in src/Module/
This commit is contained in:
parent
8998926e5b
commit
f59ea2af55
40 changed files with 115 additions and 94 deletions
|
@ -26,12 +26,12 @@ class Index extends BaseSettingsModule
|
|||
self::checkFormSecurityTokenRedirectOnError('settings/2fa', 'settings_2fa');
|
||||
|
||||
try {
|
||||
User::getIdFromPasswordAuthentication(local_user(), defaults($_POST, 'password', ''));
|
||||
User::getIdFromPasswordAuthentication(local_user(), $_POST['password'] ?? '');
|
||||
|
||||
$has_secret = (bool) PConfig::get(local_user(), '2fa', 'secret');
|
||||
$verified = PConfig::get(local_user(), '2fa', 'verified');
|
||||
|
||||
switch (defaults($_POST, 'action', '')) {
|
||||
switch ($_POST['action'] ?? '') {
|
||||
case 'enable':
|
||||
if (!$has_secret && !$verified) {
|
||||
$Google2FA = new Google2FA();
|
||||
|
|
|
@ -49,12 +49,12 @@ class Verify extends BaseSettingsModule
|
|||
return;
|
||||
}
|
||||
|
||||
if (defaults($_POST, 'action', null) == 'verify') {
|
||||
if (($_POST['action'] ?? '') == 'verify') {
|
||||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/verify', 'settings_2fa_verify');
|
||||
|
||||
$google2fa = new Google2FA();
|
||||
|
||||
$valid = $google2fa->verifyKey(PConfig::get(local_user(), '2fa', 'secret'), defaults($_POST, 'verify_code', ''));
|
||||
$valid = $google2fa->verifyKey(PConfig::get(local_user(), '2fa', 'secret'), $_POST['verify_code'] ?? '');
|
||||
|
||||
if ($valid) {
|
||||
PConfig::set(local_user(), '2fa', 'verified', true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue