Various nestor-related fixes.

This commit is contained in:
James Cole
2025-05-24 05:40:20 +02:00
parent b7ec7625c0
commit c40229e9fa
63 changed files with 222 additions and 156 deletions

View File

@@ -23,6 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Auth;
use Hash;
use Exception;
use FireflyIII\Events\UserChangedEmail;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Exceptions\ValidationException;
@@ -201,9 +204,9 @@ class ProfileController extends Controller
return redirect(route('profile.change-email'))->withInput();
}
$existing = $repository->findByEmail($newEmail);
if (null !== $existing) {
if ($existing instanceof User) {
// force user logout.
\Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
$request->session()->invalidate();
session()->flash('success', (string) trans('firefly.email_changed'));
@@ -217,7 +220,7 @@ class ProfileController extends Controller
event(new UserChangedEmail($user, $newEmail, $oldEmail));
// force user logout.
\Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
$request->session()->invalidate();
session()->flash('success', (string) trans('firefly.email_changed'));
@@ -310,7 +313,7 @@ class ProfileController extends Controller
return redirect(route('profile.index'));
}
if (!\Hash::check($request->get('password'), auth()->user()->password)) {
if (!Hash::check($request->get('password'), auth()->user()->password)) {
session()->flash('error', (string) trans('firefly.invalid_password'));
return redirect(route('profile.delete-account'));
@@ -343,8 +346,8 @@ class ProfileController extends Controller
'email' => auth()->user()->email,
'password' => $request->get('password'),
];
if (\Auth::once($creds)) {
\Auth::logoutOtherDevices($request->get('password'));
if (Auth::once($creds)) {
Auth::logoutOtherDevices($request->get('password'));
session()->flash('info', (string) trans('firefly.other_sessions_logged_out'));
return redirect(route('profile.index'));
@@ -359,7 +362,7 @@ class ProfileController extends Controller
*
* @return Redirector|RedirectResponse
*
* @throws \Exception
* @throws Exception
*/
public function regenerate(Request $request)
{