Reformat various code.

This commit is contained in:
James Cole
2022-03-29 14:58:06 +02:00
parent 1209c4e76a
commit 29bed2547c
140 changed files with 1004 additions and 1010 deletions

View File

@@ -78,7 +78,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);
@@ -110,7 +110,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'));
@@ -132,7 +132,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'));
@@ -229,7 +229,7 @@ class ProfileController extends Controller
$repository->unblockUser($user);
// return to login.
session()->flash('success', (string)trans('firefly.login_with_new_email'));
session()->flash('success', (string) trans('firefly.login_with_new_email'));
return redirect(route('login'));
}
@@ -249,7 +249,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'));
@@ -274,8 +274,8 @@ class ProfileController extends Controller
$user = auth()->user();
$repository->setMFACode($user, null);
session()->flash('success', (string)trans('firefly.pref_two_factor_auth_disabled'));
session()->flash('info', (string)trans('firefly.pref_two_factor_auth_remove_it'));
session()->flash('success', (string) trans('firefly.pref_two_factor_auth_disabled'));
session()->flash('info', (string) trans('firefly.pref_two_factor_auth_remove_it'));
return redirect(route('profile.index'));
}
@@ -304,7 +304,7 @@ class ProfileController extends Controller
// If FF3 already has a secret, just set the two factor auth enabled to 1,
// and let the user continue with the existing secret.
session()->flash('info', (string)trans('firefly.2fa_already_enabled'));
session()->flash('info', (string) trans('firefly.2fa_already_enabled'));
return redirect(route('profile.index'));
}
@@ -351,7 +351,7 @@ class ProfileController extends Controller
public function logoutOtherSessions()
{
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'));
}
@@ -409,7 +409,7 @@ class ProfileController extends Controller
$newEmail = $request->string('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();
}
@@ -419,7 +419,7 @@ class ProfileController extends Controller
Auth::guard()->logout();
$request->session()->invalidate();
session()->flash('success', (string)trans('firefly.email_changed'));
session()->flash('success', (string) trans('firefly.email_changed'));
return redirect(route('index'));
}
@@ -432,7 +432,7 @@ class ProfileController extends Controller
// force user logout.
Auth::guard()->logout();
$request->session()->invalidate();
session()->flash('success', (string)trans('firefly.email_changed'));
session()->flash('success', (string) trans('firefly.email_changed'));
return redirect(route('index'));
}
@@ -467,7 +467,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'));
}
@@ -496,7 +496,7 @@ class ProfileController extends Controller
$secret = session()->get('two-factor-secret');
$repository->setMFACode($user, $secret);
session()->flash('success', (string)trans('firefly.saved_preferences'));
session()->flash('success', (string) trans('firefly.saved_preferences'));
app('preferences')->mark();
// also save the code so replay attack is prevented.
@@ -577,7 +577,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'));
}
@@ -601,7 +601,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'));
}
@@ -611,11 +611,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'));
@@ -641,7 +641,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'));
}
@@ -681,7 +681,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;
break;
@@ -696,7 +696,7 @@ class ProfileController extends Controller
$repository->unblockUser($user);
// return to login.
session()->flash('success', (string)trans('firefly.login_with_old_email'));
session()->flash('success', (string) trans('firefly.login_with_old_email'));
return redirect(route('login'));
}