Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -65,7 +65,7 @@ class ProfileController extends Controller
$this->middleware(
static function ($request, $next) {
app('view')->share('title', (string)trans('firefly.profile'));
app('view')->share('title', (string) trans('firefly.profile'));
app('view')->share('mainTitleIcon', 'fa-user');
return $next($request);
@@ -107,7 +107,7 @@ class ProfileController extends Controller
$repository->unblockUser($user);
// return to log in.
session()->flash('success', (string)trans('firefly.login_with_new_email'));
session()->flash('success', (string) trans('firefly.login_with_new_email'));
return redirect(route('login'));
}
@@ -123,7 +123,7 @@ class ProfileController extends Controller
return redirect(route('profile.index'));
}
$title = auth()->user()->email;
$subTitle = (string)trans('firefly.delete_account');
$subTitle = (string) trans('firefly.delete_account');
$subTitleIcon = 'fa-trash';
return view('profile.delete-account', compact('title', 'subTitle', 'subTitleIcon'));
@@ -171,7 +171,7 @@ class ProfileController extends Controller
public function logoutOtherSessions(): Factory|RedirectResponse|View
{
if (!$this->internalAuth) {
session()->flash('info', (string)trans('firefly.external_auth_disabled'));
session()->flash('info', (string) trans('firefly.external_auth_disabled'));
return redirect(route('profile.index'));
}
@@ -195,7 +195,7 @@ class ProfileController extends Controller
$newEmail = $request->convertString('email');
$oldEmail = $user->email;
if ($newEmail === $user->email) {
session()->flash('error', (string)trans('firefly.email_not_changed'));
session()->flash('error', (string) trans('firefly.email_not_changed'));
return redirect(route('profile.change-email'))->withInput();
}
@@ -205,7 +205,7 @@ class ProfileController extends Controller
\Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
$request->session()->invalidate();
session()->flash('success', (string)trans('firefly.email_changed'));
session()->flash('success', (string) trans('firefly.email_changed'));
return redirect(route('index'));
}
@@ -218,7 +218,7 @@ class ProfileController extends Controller
// force user logout.
\Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
$request->session()->invalidate();
session()->flash('success', (string)trans('firefly.email_changed'));
session()->flash('success', (string) trans('firefly.email_changed'));
return redirect(route('index'));
}
@@ -236,7 +236,7 @@ class ProfileController extends Controller
$title = auth()->user()->email;
$email = auth()->user()->email;
$subTitle = (string)trans('firefly.change_your_email');
$subTitle = (string) trans('firefly.change_your_email');
$subTitleIcon = 'fa-envelope';
return view('profile.change-email', compact('title', 'subTitle', 'subTitleIcon', 'email'));
@@ -271,7 +271,7 @@ class ProfileController extends Controller
}
$repository->changePassword($user, $request->get('new_password'));
session()->flash('success', (string)trans('firefly.password_changed'));
session()->flash('success', (string) trans('firefly.password_changed'));
return redirect(route('profile.index'));
}
@@ -290,7 +290,7 @@ class ProfileController extends Controller
}
$title = auth()->user()->email;
$subTitle = (string)trans('firefly.change_your_password');
$subTitle = (string) trans('firefly.change_your_password');
$subTitleIcon = 'fa-key';
return view('profile.change-password', compact('title', 'subTitle', 'subTitleIcon'));
@@ -310,7 +310,7 @@ class ProfileController extends Controller
}
if (!\Hash::check($request->get('password'), auth()->user()->password)) {
session()->flash('error', (string)trans('firefly.invalid_password'));
session()->flash('error', (string) trans('firefly.invalid_password'));
return redirect(route('profile.delete-account'));
}
@@ -334,7 +334,7 @@ class ProfileController extends Controller
public function postLogoutOtherSessions(Request $request)
{
if (!$this->internalAuth) {
session()->flash('info', (string)trans('firefly.external_auth_disabled'));
session()->flash('info', (string) trans('firefly.external_auth_disabled'));
return redirect(route('profile.index'));
}
@@ -344,11 +344,11 @@ class ProfileController extends Controller
];
if (\Auth::once($creds)) {
\Auth::logoutOtherDevices($request->get('password'));
session()->flash('info', (string)trans('firefly.other_sessions_logged_out'));
session()->flash('info', (string) trans('firefly.other_sessions_logged_out'));
return redirect(route('profile.index'));
}
session()->flash('error', (string)trans('auth.failed'));
session()->flash('error', (string) trans('auth.failed'));
return redirect(route('profile.index'));
}
@@ -372,7 +372,7 @@ class ProfileController extends Controller
$user = auth()->user();
$token = $user->generateAccessToken();
app('preferences')->set('access_token', $token);
session()->flash('success', (string)trans('firefly.token_regenerated'));
session()->flash('success', (string) trans('firefly.token_regenerated'));
return redirect(route('profile.index'));
}
@@ -410,7 +410,7 @@ class ProfileController extends Controller
/** @var string $match */
$match = null;
foreach ($set as $entry) {
$hashed = hash('sha256', sprintf('%s%s', (string)config('app.key'), $entry->data));
$hashed = hash('sha256', sprintf('%s%s', (string) config('app.key'), $entry->data));
if ($hashed === $hash) {
$match = $entry->data;
@@ -426,7 +426,7 @@ class ProfileController extends Controller
$repository->unblockUser($user);
// return to login page.
session()->flash('success', (string)trans('firefly.login_with_old_email'));
session()->flash('success', (string) trans('firefly.login_with_old_email'));
return redirect(route('login'));
}