mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
remove "twoFactorAuthEnabled" from preferences. Kill switches for all code that references them (easier for refactor)
This commit is contained in:
@@ -88,7 +88,7 @@ class PreferenceController extends Controller
|
||||
$available = [
|
||||
'language', 'customFiscalYear', 'fiscalYearStart', 'currencyPreference',
|
||||
'transaction_journal_optional_fields', 'frontPageAccounts', 'viewRange',
|
||||
'listPageSize, twoFactorAuthEnabled',
|
||||
'listPageSize',
|
||||
];
|
||||
|
||||
$preferences = new Collection;
|
||||
@@ -166,7 +166,6 @@ class PreferenceController extends Controller
|
||||
$newValue = (int)$data['data'];
|
||||
break;
|
||||
case 'customFiscalYear':
|
||||
case 'twoFactorAuthEnabled':
|
||||
$newValue = 1 === (int)$data['data'];
|
||||
break;
|
||||
}
|
||||
|
@@ -125,6 +125,7 @@ class UserController extends Controller
|
||||
$users = $this->repository->all();
|
||||
|
||||
// add meta stuff.
|
||||
die('the 2FA references here should be refactored.');
|
||||
$users->each(
|
||||
function (User $user) {
|
||||
$list = ['twoFactorAuthEnabled', 'twoFactorAuthSecret'];
|
||||
|
@@ -47,6 +47,7 @@ class TwoFactorController extends Controller
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
die('this auth controller must be refactored.');
|
||||
$user = auth()->user();
|
||||
|
||||
// to make sure the validator in the next step gets the secret, we push it in session
|
||||
|
@@ -218,6 +218,7 @@ class ProfileController extends Controller
|
||||
*/
|
||||
public function deleteCode()
|
||||
{
|
||||
die('this method is deprecated.');
|
||||
app('preferences')->delete('twoFactorAuthEnabled');
|
||||
app('preferences')->delete('twoFactorAuthSecret');
|
||||
session()->flash('success', (string)trans('firefly.pref_two_factor_auth_disabled'));
|
||||
@@ -233,6 +234,7 @@ class ProfileController extends Controller
|
||||
*/
|
||||
public function enable2FA()
|
||||
{
|
||||
die('this method is deprecated.');
|
||||
$hasSecret = (null !== app('preferences')->get('twoFactorAuthSecret'));
|
||||
|
||||
// if we don't have a valid secret yet, redirect to the code page to get one.
|
||||
@@ -255,6 +257,7 @@ class ProfileController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
die('remove or refactor references to 2FA before continuing.');
|
||||
$loginProvider = config('firefly.login_provider');
|
||||
// check if client token thing exists (default one)
|
||||
$count = DB::table('oauth_clients')
|
||||
@@ -388,6 +391,7 @@ class ProfileController extends Controller
|
||||
*/
|
||||
public function postCode(TokenFormRequest $request)
|
||||
{
|
||||
die('this method is deprecated');
|
||||
app('preferences')->set('twoFactorAuthEnabled', 1);
|
||||
app('preferences')->set('twoFactorAuthSecret', session()->get('two-factor-secret'));
|
||||
|
||||
|
@@ -66,6 +66,7 @@ class AuthenticateTwoFactor
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
die('this middleware is deprecated.');
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
if ($this->auth->guest()) {
|
||||
return response()->redirectTo(route('login'));
|
||||
|
@@ -43,6 +43,7 @@ class RedirectIfTwoFactorAuthenticated
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
die('this middleware is deprecated.');
|
||||
if (Auth::guard($guard)->check()) {
|
||||
$is2faEnabled = app('preferences')->get('twoFactorAuthEnabled', false)->data;
|
||||
$has2faSecret = null !== app('preferences')->get('twoFactorAuthSecret');
|
||||
|
@@ -245,6 +245,7 @@ class UserRepository implements UserRepositoryInterface
|
||||
$return = [];
|
||||
|
||||
// two factor:
|
||||
die('this method references 2FA and must be refactored.');
|
||||
$is2faEnabled = app('preferences')->getForUser($user, 'twoFactorAuthEnabled', false)->data;
|
||||
$has2faSecret = null !== app('preferences')->getForUser($user, 'twoFactorAuthSecret');
|
||||
$return['has_2fa'] = false;
|
||||
|
Reference in New Issue
Block a user