Skip to content

Commit

Permalink
Avoid the secret answer to be replaced by an empty string when changi…
Browse files Browse the repository at this point in the history
…ng other fields in the account page leaving empty the secret question - fixes #2178

Signed-off-by: emanuele <emanuele45@gmail.com>
  • Loading branch information
emanuele45 committed Aug 11, 2015
1 parent 18b0fcd commit 5302e66
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sources/subs/Profile.subs.php
Expand Up @@ -805,6 +805,26 @@ function loadProfileFields($force_reload = false)
'value' => '',
'permission' => 'profile_identity',
'input_validate' => create_function('&$value', '
global $cur_profile;
if (empty($value))
{
require_once(SUBSDIR . \'/Members.subs.php\');
$member = getBasicMemberData($cur_profile[\'id_member\'], array(\'authentication\' => true));
// No previous answer was saved, so that\'s all good
if (empty($member[\'secret_answer\']))
{
return true;
}
// There is a previous secret answer to the secret question, so let\'s put it back in the db...
else
{
$value = $member[\'secret_answer\'];
// We have to tell the code is an error otherwise an empty value will go into the db
return false;
}
}
$value = $value != \'\' ? md5($value) : \'\';
return true;
'),
Expand Down

0 comments on commit 5302e66

Please sign in to comment.