mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-02-13 15:20:29 +00:00
Autoformat lol
This commit is contained in:
@@ -23,10 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use FireflyIII\Events\Security\User\UserChangedEmailAddress;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Exception;
|
||||
use FireflyIII\Events\Security\User\UserChangedEmailAddress;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Exceptions\ValidationException;
|
||||
use FireflyIII\Http\Middleware\IsDemoUser;
|
||||
@@ -35,6 +33,7 @@ use FireflyIII\Http\Requests\EmailFormRequest;
|
||||
use FireflyIII\Http\Requests\ProfileFormRequest;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\Support\Http\Controllers\CreateStuff;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
@@ -48,6 +47,7 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use Laravel\Passport\ClientRepository;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
@@ -72,15 +72,13 @@ class ProfileController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->middleware(
|
||||
static function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.profile'));
|
||||
app('view')->share('mainTitleIcon', 'fa-user');
|
||||
$this->middleware(static function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.profile'));
|
||||
app('view')->share('mainTitleIcon', 'fa-user');
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
$authGuard = config('firefly.authentication_guard');
|
||||
return $next($request);
|
||||
});
|
||||
$authGuard = config('firefly.authentication_guard');
|
||||
$this->internalAuth = 'web' === $authGuard;
|
||||
Log::debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
|
||||
|
||||
@@ -137,7 +135,7 @@ class ProfileController extends Controller
|
||||
$subTitle = (string) trans('firefly.delete_account');
|
||||
$subTitleIcon = 'fa-trash';
|
||||
|
||||
return view('profile.delete-account', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
|
||||
return view('profile.delete-account', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +149,10 @@ class ProfileController extends Controller
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$isInternalAuth = $this->internalAuth;
|
||||
$count = DB::table('oauth_clients')->where('personal_access_client', true)->whereNull('user_id')->count();
|
||||
$count = DB::table('oauth_clients')
|
||||
->where('personal_access_client', true)
|
||||
->whereNull('user_id')
|
||||
->count();
|
||||
$subTitle = $user->email;
|
||||
$userId = $user->id;
|
||||
$enabled2FA = null !== $user->mfa_secret;
|
||||
@@ -169,16 +170,20 @@ class ProfileController extends Controller
|
||||
$repository->createPersonalAccessClient(null, $name, 'http://localhost');
|
||||
}
|
||||
|
||||
$accessToken = Preferences::get('access_token');
|
||||
$accessToken = Preferences::get('access_token');
|
||||
if (null === $accessToken) {
|
||||
$token = $user->generateAccessToken();
|
||||
$accessToken = Preferences::set('access_token', $token);
|
||||
}
|
||||
|
||||
return view(
|
||||
'profile.index',
|
||||
['subTitle' => $subTitle, 'mfaBackupCount' => $mfaBackupCount, 'userId' => $userId, 'accessToken' => $accessToken, 'enabled2FA' => $enabled2FA, 'isInternalAuth' => $isInternalAuth]
|
||||
);
|
||||
return view('profile.index', [
|
||||
'subTitle' => $subTitle,
|
||||
'mfaBackupCount' => $mfaBackupCount,
|
||||
'userId' => $userId,
|
||||
'accessToken' => $accessToken,
|
||||
'enabled2FA' => $enabled2FA,
|
||||
'isInternalAuth' => $isInternalAuth
|
||||
]);
|
||||
}
|
||||
|
||||
public function logoutOtherSessions(): Factory|RedirectResponse|View
|
||||
@@ -252,7 +257,7 @@ class ProfileController extends Controller
|
||||
$subTitle = (string) trans('firefly.change_your_email');
|
||||
$subTitleIcon = 'fa-envelope';
|
||||
|
||||
return view('profile.change-email', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'email' => $email]);
|
||||
return view('profile.change-email', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'email' => $email]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,7 +276,7 @@ class ProfileController extends Controller
|
||||
$new = $request->get('new_password');
|
||||
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
|
||||
try {
|
||||
$this->validatePassword($user, $current, $new);
|
||||
@@ -304,7 +309,7 @@ class ProfileController extends Controller
|
||||
$subTitle = (string) trans('firefly.change_your_password');
|
||||
$subTitleIcon = 'fa-key';
|
||||
|
||||
return view('profile.change-password', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
|
||||
return view('profile.change-password', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -347,10 +352,7 @@ class ProfileController extends Controller
|
||||
|
||||
return redirect(route('profile.index'));
|
||||
}
|
||||
$creds = [
|
||||
'email' => auth()->user()->email,
|
||||
'password' => $request->get('password'),
|
||||
];
|
||||
$creds = ['email' => auth()->user()->email, 'password' => $request->get('password')];
|
||||
if (Auth::once($creds)) {
|
||||
Auth::logoutOtherDevices($request->get('password'));
|
||||
session()->flash('info', (string) trans('firefly.other_sessions_logged_out'));
|
||||
@@ -396,8 +398,8 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
// find preference with this token value.
|
||||
$set = Preferences::findByName('email_change_undo_token');
|
||||
$user = null;
|
||||
$set = Preferences::findByName('email_change_undo_token');
|
||||
$user = null;
|
||||
|
||||
/** @var Preference $preference */
|
||||
foreach ($set as $preference) {
|
||||
@@ -410,7 +412,7 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
// found user.which email address to return to?
|
||||
$set = Preferences::beginsWith($user, 'previous_email_');
|
||||
$set = Preferences::beginsWith($user, 'previous_email_');
|
||||
|
||||
/** @var null|string $match */
|
||||
$match = null;
|
||||
|
||||
Reference in New Issue
Block a user