WebWizard: Add removeToken option to method clearSession

refs #9658
This commit is contained in:
Noah Hilverling 2016-12-22 14:18:38 +01:00
parent 19f2c813f1
commit a230fd4aa8
2 changed files with 10 additions and 6 deletions

View File

@ -79,7 +79,7 @@ class IndexController extends Controller
$form = new Form(array( $form = new Form(array(
'onSuccess' => function () { 'onSuccess' => function () {
$wizard = new WebWizard(); $wizard = new WebWizard();
$wizard->clearSession(); $wizard->clearSession(false);
} }
)); ));
$form->setUidDisabled(); $form->setUidDisabled();

View File

@ -380,15 +380,19 @@ class WebWizard extends Wizard implements SetupWizard
} }
/** /**
* Clear the session being used by this wizard and drop the setup token * Clear the session being used by this wizard
*
* @param bool $removeToken If true, the setup token will be removed
*/ */
public function clearSession() public function clearSession($removeToken = true)
{ {
parent::clearSession(); parent::clearSession();
$tokenPath = Config::resolvePath('setup.token'); if ($removeToken) {
if (file_exists($tokenPath)) { $tokenPath = Config::resolvePath('setup.token');
@unlink($tokenPath); if (file_exists($tokenPath)) {
@unlink($tokenPath);
}
} }
} }