+
+ /**
+ * Show the view for the "Access & Security" account options.
+ */
+ public function showAuth(SocialDriverManager $socialDriverManager)
+ {
+ $mfaMethods = user()->mfaValues()->get()->groupBy('method');
+
+ $this->setPageTitle(trans('preferences.auth'));
+
+ return view('users.account.auth', [
+ 'category' => 'auth',
+ 'mfaMethods' => $mfaMethods,
+ 'authMethod' => config('auth.method'),
+ 'activeSocialDrivers' => $socialDriverManager->getActive(),
+ ]);
+ }
+
+ /**
+ * Handle the submission for the auth change password form.
+ */
+ public function updatePassword(Request $request)
+ {
+ $this->preventAccessInDemoMode();
+
+ if (config('auth.method') !== 'standard') {
+ $this->showPermissionError();
+ }
+
+ $validated = $this->validate($request, [
+ 'password' => ['required_with:password_confirm', Password::default()],
+ 'password-confirm' => ['same:password', 'required_with:password'],
+ ]);
+
+ $this->userRepo->update(user(), $validated, false);
+
+ $this->showSuccessNotification(trans('preferences.auth_change_password_success'));
+
+ return redirect('/my-account/auth');
+ }
+
+ /**
+ * Show the user self-delete page.
+ */
+ public function delete()
+ {
+ $this->setPageTitle(trans('preferences.delete_my_account'));
+
+ return view('users.account.delete', [
+ 'category' => 'profile',
+ ]);
+ }
+
+ /**
+ * Remove the current user from the system.
+ */
+ public function destroy(Request $request)
+ {
+ $this->preventAccessInDemoMode();
+
+ $requestNewOwnerId = intval($request->get('new_owner_id')) ?: null;
+ $newOwnerId = userCan('users-manage') ? $requestNewOwnerId : null;
+
+ $this->userRepo->destroy(user(), $newOwnerId);
+
+ return redirect('/');
+ }