Skip to content
Snippets Groups Projects
Commit b3722889 authored by Laurent's avatar Laurent
Browse files

dev #65756 when need authentication to access an admin URL, redirect to this...

dev #65756 when need authentication to access an admin URL, redirect to this URL after successful login
parent 9099a791
3 merge requests!2409Master,!2406Dev#65756 s91 afficher le media ou le player omeka dans bokeh base de demo et projets a venir,!2402Dev#65756 s91 afficher le media ou le player omeka dans bokeh base de demo et projets a venir
......@@ -53,7 +53,7 @@ class Admin_AuthController extends Zend_Controller_Action {
if (!$auth->authenticateLoginPassword($username, $password, [$auth->newAuthDb()]))
return;
$this->_redirect($this->_getParam('redirect', 'admin/'));
$this->_redirect($this->_request->getPost('redirect', 'admin/'));
}
......
......@@ -19,7 +19,10 @@
<td width="50%" height="55" align="left" valign="middle">&nbsp;&nbsp;<input type="password" name="password" onkeypress="if (event.keyCode == 13) {javascript:PicToolbarOver( getElementById('menu_item975'), 'menu_item975');this.form.submit();return false;}" value=""/></td>
</tr>
<tr class="dark">
<td colspan="2" width="50%" height="66" align="center"><?php echo $this->Button_Submit(); ?></td>
<td colspan="2" width="50%" height="66" align="center">
<input type="hidden" name="redirect" value="<?php echo $this->redirect ?>"/>
<?php echo $this->Button_Submit(); ?>
</td>
</tr>
</table>
</div>
......
......@@ -72,7 +72,8 @@ class ZendAfi_Controller_Plugin_AdminAuth extends Zend_Controller_Plugin_Abstrac
if (!$user = Class_Users::getIdentity()) {
$request->setControllerName('auth')
->setActionName('login');
->setActionName('login')
->setParam('redirect', $request->getRequestUri());
return;
}
......
......@@ -58,6 +58,13 @@ class AdminAuthControllerNobodyLoggedTest extends Admin_AbstractControllerTestCa
}
/** @test */
public function whileNotConnectedShouldIncludeHiddenInputWithRedirectToDesiredUrl() {
$this->dispatch('/admin/cms/edit/id/3', true);
$this->assertXPath('//input[@type="hidden"][@name="redirect"][@value="/admin/cms/edit/id/3"]');
}
/** @test */
public function withAuthenticationSuccessfullAndRedirectShouldRedirectToIt() {
$this->_auth->whenCalled('authenticateLoginPassword')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment