ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: Flavio93Zena on August 01, 2015, 04:03:08 pm

Title: Critical secret answer bug
Post by: Flavio93Zena on August 01, 2015, 04:03:08 pm
http://www.simplemachines.org/community/index.php?topic=538642.0
This is present in Elkarte as well. It always refuses your secret answer if you do that procedure, no matter if you leave it blank or type the correct reply.
Title: Re: Critical secret answer bug
Post by: emanuele on August 01, 2015, 06:56:13 pm
What a pain in the plumbers crack that profile code... >_<

Dealing with what we have now, I guess this should work:
Code: [Select]
			'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;
'),

But I'm slightly sleepy and create_function always give me a headache... :-\
Title: Re: Critical secret answer bug
Post by: live627 on August 01, 2015, 08:04:10 pm
Quotepain in the plumbers crack
This deserves a like :D

QuoteBut I'm slightly sleepy and create_function always give me a headache... :-\
Then use closures. I think a full disclosure is always nice:  that was a horrible pun.
Title: Re: Critical secret answer bug
Post by: Flavio93Zena on August 02, 2015, 01:09:34 am
Well, I hope they get it right on SMF as well, not too confident tbh xD
Title: Re: Critical secret answer bug
Post by: emanuele on August 02, 2015, 02:38:28 am
Quote from: live627 –
Quotepain in the plumbers crack
This deserves a like :D
Another of spuds' censoring. LOL

1.0 is (still) with create_functions, so for consistency it's better to fix it like that, 1.1 is another story. ;D
Title: Re: Critical secret answer bug
Post by: live627 on August 02, 2015, 03:32:15 am
Censorship done right!

Did Spuds censor his name, too?
Title: Re: Critical secret answer bug
Post by: Spuds on August 02, 2015, 06:00:58 am
Not recently, that I know of, but several other folks could if they want :D
Title: Re: Critical secret answer bug
Post by: Flavio93Zena on August 02, 2015, 10:36:04 am
They are still messing with the code at sm.org instead :( shrug
Title: Re: Critical secret answer bug
Post by: emanuele on August 11, 2015, 08:42:01 am
Tracked: https://github.com/elkarte/Elkarte/issues/2178