From: Mike G. v. a. <we...@ma...> - 2005-01-28 01:20:15
|
Log Message: ----------- I believe this will fix the bug which sometimes causes multiple users to appear in the parameters. The problem is that Login.pm filters out user, key, passwd values and then passes the remaining values to hidden_fields to be printed on the "relogin" page. Unfortunately if hidden_fields is passed an empty array then it prints ALL values in the parameter hash as hidden fields. So if only user and key are present they will be printed as hidden fields. If user, key and a non-filtered paramter value are present then only the non-filtered parameter value will be printed. The current fix is a conditional which doesn't call hidden_fields at all if there are no parameters left after the filtering operation. --Mike Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator: Login.pm Revision Data ------------- Index: Login.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Login.pm,v retrieving revision 1.23 retrieving revision 1.24 diff -Llib/WeBWorK/ContentGenerator/Login.pm -Llib/WeBWorK/ContentGenerator/Login.pm -u -r1.23 -r1.24 --- lib/WeBWorK/ContentGenerator/Login.pm +++ lib/WeBWorK/ContentGenerator/Login.pm @@ -106,12 +106,16 @@ print CGI::startform({-method=>"POST", -action=>$r->uri}); - # write out the form data posted to the requested URI - #print $self->print_form_data('<input type="hidden" name="','" value="',"\"/>\n",qr/^(user|passwd|key|force_passwd_authen)$/); # preserve the form data posted to the requested URI my @fields_to_print = grep { not m/^(user|passwd|key|force_passwd_authen)$/ } $r->param; - print $self->hidden_fields(@fields_to_print); + + #FIXME: This next line can be removed in time. MEG 1/27/2005 + warn "Error in filtering fields : |", join("|",@fields_to_print),"|" if grep {m/user/} @fields_to_print; + + # Important note. If hidden_fields is passed an empty array it prints ALL parameters as hidden fields. + # That is not what we want in this case, so we don't print at all if @fields_to_print is empty. + print $self->hidden_fields(@fields_to_print) if @fields_to_print > 0; print CGI::table({class=>"FormLayout"}, CGI::Tr([ |