Save old data; bread crumbs

This commit is contained in:
James Cole 2016-08-04 06:14:08 +02:00
parent 5f5469a7d4
commit 09d63b584d
2 changed files with 18 additions and 2 deletions

View File

@ -17,6 +17,7 @@ use FireflyIII\Http\Requests\DeleteAccountFormRequest;
use FireflyIII\Http\Requests\ProfileFormRequest; use FireflyIII\Http\Requests\ProfileFormRequest;
use FireflyIII\User; use FireflyIII\User;
use Hash; use Hash;
use Preferences;
use Session; use Session;
/** /**
@ -111,7 +112,8 @@ class ProfileController extends Controller
event(new UserIsDeleted(Auth::user(), $request->ip())); event(new UserIsDeleted(Auth::user(), $request->ip()));
// store some stuff for the future: // store some stuff for the future:
$registration = Preferences::get('registration_ip_address')->data;
$confirmation = Preferences::get('confirmation_ip_address')->data;
// DELETE! // DELETE!
$email = Auth::user()->email; $email = Auth::user()->email;
@ -121,7 +123,7 @@ class ProfileController extends Controller
Session::flash('gaEventAction', 'delete-account'); Session::flash('gaEventAction', 'delete-account');
// create a new user with the same email address so re-registration is blocked. // create a new user with the same email address so re-registration is blocked.
User::create( $newUser = User::create(
[ [
'email' => $email, 'email' => $email,
'password' => 'deleted', 'password' => 'deleted',
@ -129,6 +131,13 @@ class ProfileController extends Controller
'blocked_code' => 'deleted', 'blocked_code' => 'deleted',
] ]
); );
if (strlen($registration) > 0) {
Preferences::setForUser($newUser, 'registration_ip_address', $registration);
}
if (strlen($confirmation) > 0) {
Preferences::setForUser($newUser, 'confirmation_ip_address', $confirmation);
}
return redirect(route('index')); return redirect(route('index'));
} }

View File

@ -113,6 +113,13 @@ Breadcrumbs::register(
} }
); );
Breadcrumbs::register(
'admin.users.domains', function (BreadCrumbGenerator $breadcrumbs) {
$breadcrumbs->parent('admin.index');
$breadcrumbs->push(trans('firefly.blocked_domains'), route('admin.users.domains'));
}
);
/** /**
* ATTACHMENTS * ATTACHMENTS
*/ */