mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 10:53:37 +00:00
Code clean up.
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Auth;
|
||||
@@ -32,17 +31,15 @@ use Log;
|
||||
use Preferences;
|
||||
|
||||
/**
|
||||
* Class TwoFactorController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers\Auth
|
||||
* Class TwoFactorController.
|
||||
*/
|
||||
class TwoFactorController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
@@ -53,16 +50,16 @@ class TwoFactorController extends Controller
|
||||
|
||||
// to make sure the validator in the next step gets the secret, we push it in session
|
||||
$secretPreference = Preferences::get('twoFactorAuthSecret', null);
|
||||
$secret = is_null($secretPreference) ? null : $secretPreference->data;
|
||||
$secret = null === $secretPreference ? null : $secretPreference->data;
|
||||
$title = strval(trans('firefly.two_factor_title'));
|
||||
|
||||
// make sure the user has two factor configured:
|
||||
$has2FA = Preferences::get('twoFactorAuthEnabled', false)->data;
|
||||
if (is_null($has2FA) || $has2FA === false) {
|
||||
if (null === $has2FA || false === $has2FA) {
|
||||
return redirect(route('index'));
|
||||
}
|
||||
|
||||
if (strlen(strval($secret)) === 0) {
|
||||
if (0 === strlen(strval($secret))) {
|
||||
throw new FireflyException('Your two factor authentication secret is empty, which it cannot be at this point. Please check the log files.');
|
||||
}
|
||||
$request->session()->flash('two-factor-secret', $secret);
|
||||
@@ -72,6 +69,7 @@ class TwoFactorController extends Controller
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function lostTwoFactor()
|
||||
@@ -95,7 +93,6 @@ class TwoFactorController extends Controller
|
||||
*
|
||||
* @return mixed
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation.
|
||||
*
|
||||
*/
|
||||
public function postIndex(TokenFormRequest $request, CookieJar $cookieJar)
|
||||
{
|
||||
|
Reference in New Issue
Block a user