/**
  * @param DeleteAccountFormRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Exception
  */
 public function postDeleteAccount(DeleteAccountFormRequest $request)
 {
     // old, new1, new2
     if (!Hash::check($request->get('password'), auth()->user()->password)) {
         Session::flash('error', strval(trans('firefly.invalid_password')));
         return redirect(route('profile.delete-account'));
     }
     // respond to deletion:
     event(new UserIsDeleted(auth()->user(), $request->ip()));
     // store some stuff for the future:
     $registration = Preferences::get('registration_ip_address')->data;
     $confirmation = Preferences::get('confirmation_ip_address')->data;
     // DELETE!
     $email = auth()->user()->email;
     auth()->user()->delete();
     Session::flush();
     Session::flash('gaEventCategory', 'user');
     Session::flash('gaEventAction', 'delete-account');
     // create a new user with the same email address so re-registration is blocked.
     $newUser = User::create(['email' => $email, 'password' => 'deleted', 'blocked' => 1, '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'));
 }
示例#2
0
 /**
  * @param DeleteAccountFormRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Exception
  */
 public function postDeleteAccount(DeleteAccountFormRequest $request)
 {
     // old, new1, new2
     if (!Hash::check($request->get('password'), Auth::user()->password)) {
         Session::flash('error', trans('firefly.invalid_password'));
         return redirect(route('profile.delete-account'));
     }
     // DELETE!
     $email = Auth::user()->email;
     Auth::user()->delete();
     Session::flush();
     Session::flash('gaEventCategory', 'user');
     Session::flash('gaEventAction', 'delete-account');
     // create a new user with the same email address so re-registration is blocked.
     User::create(['email' => $email, 'password' => 'deleted', 'blocked' => 1, 'blocked_code' => 'deleted']);
     return redirect(route('index'));
 }
示例#3
0
 /**
  * @param DeleteAccountFormRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Exception
  */
 public function postDeleteAccount(DeleteAccountFormRequest $request)
 {
     // old, new1, new2
     if (!Hash::check($request->get('password'), Auth::user()->password)) {
         Session::flash('error', 'Invalid password!');
         return Redirect::route('profile.delete-account');
     }
     // DELETE!
     Auth::user()->delete();
     Session::flush();
     Session::flash('gaEventCategory', 'user');
     Session::flash('gaEventAction', 'delete-account');
     return Redirect::route('index');
 }