Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Do not trigger the "setNewPassword" hook twice (see #5247)
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Apr 17, 2013
1 parent 5c25875 commit 56c5c5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
12 changes: 1 addition & 11 deletions contao/modules/ModulePersonalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected function compile()
}

// Trigger the save_callback (see #5247)
if (!$objWidget->hasErrors() && is_array($arrData['save_callback']))
if ($objWidget->submitInput() && !$objWidget->hasErrors() && is_array($arrData['save_callback']))
{
foreach ($arrData['save_callback'] as $callback)
{
Expand Down Expand Up @@ -241,16 +241,6 @@ protected function compile()
// Set the new field in the member model
$blnModified = true;
$objMember->$field = $varValue;

// HOOK: set new password callback
if ($objWidget instanceof \FormPassword && isset($GLOBALS['TL_HOOKS']['setNewPassword']) && is_array($GLOBALS['TL_HOOKS']['setNewPassword']))
{
foreach ($GLOBALS['TL_HOOKS']['setNewPassword'] as $callback)
{
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this->User, $varValue, $this);
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions contao/modules/ModuleRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ protected function compile()
}

// Save callback
if (is_array($arrData['save_callback']))
if ($objWidget->submitInput() && !$objWidget->hasErrors() && is_array($arrData['save_callback']))
{
foreach ($arrData['save_callback'] as $callback)
{
$this->import($callback[0]);

try
{
$varValue = $this->$callback[0]->$callback[1]($varValue, $this->User);
$varValue = $this->$callback[0]->$callback[1]($varValue, null);
}
catch (\Exception $e)
{
Expand Down

0 comments on commit 56c5c5a

Please sign in to comment.