Built a routine that will allow you to completely delete an account.

This commit is contained in:
James Cole
2015-04-22 07:54:56 +02:00
parent 0d3213a379
commit fe714e9989
6 changed files with 121 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
use Auth;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\DeleteAccountFormRequest;
use FireflyIII\Http\Requests\ProfileFormRequest;
use Hash;
use Redirect;
@@ -34,6 +35,36 @@ class ProfileController extends Controller
return view('profile.index')->with('title', 'Profile')->with('subTitle', Auth::user()->email)->with('mainTitleIcon', 'fa-user');
}
/**
* @return \Illuminate\View\View
*/
public function deleteAccount()
{
return view('profile.delete-account')->with('title', Auth::user()->email)->with('subTitle', 'Delete account')->with(
'mainTitleIcon', 'fa-user'
);
}
/**
*
*/
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('delete-account');
}
// DELETE!
Auth::user()->delete();
Session::flush();
return Redirect::route('index');
}
/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/