fix - [ 1203834 ] accounts created by anon. reg. disobey def. userprofile settings

This commit is contained in:
Roy Johnson 2005-06-08 20:04:10 +00:00
parent 64e287d424
commit 8047fd264d
2 changed files with 11 additions and 4 deletions

View file

@ -486,16 +486,19 @@ The default value for this variable. If the variable is undefined then the defau
=cut =cut
sub process { sub process {
my ($name, $type, $default) = @_; my ($name, $type, $default) = @_;
my $value; my $value;
$type = "text" if ($type eq ""); $type = "text" if ($type eq "");
$value = &$type($name); $value = &$type($name);
unless (defined $value) { unless (defined $value) {
return $default; return $default;
} }
if ($value =~ /^[\s]+$/) { if ($value =~ /^[\s]+$/) {
return undef; return undef;
} }
return $value; return $value;
} }
@ -631,7 +634,6 @@ sub timeField {
Returns a URL. Returns a URL.
=head3 name =head3 name
The name of the form variable to retrieve. The name of the form variable to retrieve.
=cut =cut
@ -652,7 +654,7 @@ sub url {
=head2 yesNo ( name ) =head2 yesNo ( name )
Returns either a 1 or 0 representing yes and no. Defaults to "0". Returns either a 1 or 0 or undef representing yes, no, and undefined. Defaults to "0".
=head3 name =head3 name
@ -664,7 +666,12 @@ sub yesNo {
if ($session{form}{$_[0]} > 0) { if ($session{form}{$_[0]} > 0) {
return 1; return 1;
} }
return 0; elsif ($session{form}{$_[0]} eq "") {
return undef;
}
else {
return 0;
}
} }

View file

@ -114,7 +114,7 @@ sub validateProfileData {
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId $a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
and userProfileCategory.editable=1 and userProfileField.editable=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber"); and userProfileCategory.editable=1 and userProfileField.editable=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber");
while (%field = $a->hash) { while (%field = $a->hash) {
$data{$field{fieldName}} = WebGUI::Macro::negate(WebGUI::FormProcessor::process($field{fieldName},$field{dataType},"")); $data{$field{fieldName}} = WebGUI::Macro::negate(WebGUI::FormProcessor::process($field{fieldName},$field{dataType}, $field{dataDefault}));
if ($field{required} && $data{$field{fieldName}} eq "") { if ($field{required} && $data{$field{fieldName}} eq "") {
$error .= '<li>'.(eval $field{fieldLabel}).' '.WebGUI::International::get(451); $error .= '<li>'.(eval $field{fieldLabel}).' '.WebGUI::International::get(451);
}elsif($field{fieldName} eq "email" && isDuplicateEmail($data{$field{fieldName}})){ }elsif($field{fieldName} eq "email" && isDuplicateEmail($data{$field{fieldName}})){