Prevent dataform from caching when the form contains a captcha. Fixes bug #11049
This commit is contained in:
parent
26f7dd8bca
commit
0e09072bc0
3 changed files with 34 additions and 3 deletions
|
|
@ -37,6 +37,7 @@
|
|||
- fixed failure in test 250 of t/00_compile.t
|
||||
- fixed #11084: option to view private profiles
|
||||
- fixed #11082: Admin group in Visitor group?
|
||||
- fixed #11049: form caching incorrectly
|
||||
|
||||
7.8.0
|
||||
- upgraded YUI to 2.8.0r4
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use WebGUI::Asset::Wobject;
|
|||
use WebGUI::Pluggable;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Group;
|
||||
use WebGUI::AssetCollateral::DataForm::Entry;
|
||||
use WebGUI::Form::SelectRichEditor;
|
||||
|
|
@ -225,7 +226,8 @@ an entry is being viewed, bypass caching altogether.
|
|||
|
||||
sub getContentLastModified {
|
||||
my $self = shift;
|
||||
if ($self->currentView eq 'list' || $self->session->form->process('entryId')) {
|
||||
my $hasCaptcha = isIn('Captcha', map { $_->{type} } map { $self->getFieldConfig($_) } @{ $self->getFieldOrder });
|
||||
if ($self->currentView eq 'list' || $self->session->form->process('entryId') || $hasCaptcha) {
|
||||
return time;
|
||||
}
|
||||
return $self->SUPER::getContentLastModified;
|
||||
|
|
@ -1597,7 +1599,7 @@ sub www_editFieldSave {
|
|||
$newSelf->createField($newName, \%field);
|
||||
}
|
||||
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session);
|
||||
my $freshSelf = $newSelf->cloneFromDb();
|
||||
if ($form->process("proceed") eq "editField") {
|
||||
return $freshSelf->www_editField('new');
|
||||
|
|
|
|||
|
|
@ -36,6 +36,12 @@ my $df = WebGUI::Asset->getImportNode( $session )
|
|||
fieldConfiguration => '[]',
|
||||
} );
|
||||
|
||||
my $dform = WebGUI::Asset->getDefault($session)->addChild({
|
||||
className => "WebGUI::Asset::Wobject::DataForm",
|
||||
mailData => 0,
|
||||
});
|
||||
$dform->createField('gotCaptcha', { type => 'Captcha', name => 'humanCheck', });
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
$versionTag->commit;
|
||||
|
|
@ -43,7 +49,7 @@ $versionTag->commit;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 1; # Increment this number for each test you create
|
||||
plan tests => 4; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# _createForm
|
||||
|
|
@ -60,4 +66,26 @@ $df->_createForm(
|
|||
|
||||
is($WebGUI::Test::logger_error, "Unable to load form control - MASSIVE FORM FAILURE", '_createForm logs when it cannot load a form type');
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# getContentLastModified
|
||||
|
||||
sleep 3;
|
||||
|
||||
$df->{_mode} = 'form';
|
||||
is($df->getContentLastModified, $df->get('lastModified'), 'getContentLastModified: form normally returns lastModified');
|
||||
$df->{_mode} = 'list';
|
||||
cmp_ok(
|
||||
$df->getContentLastModified,
|
||||
'>',
|
||||
$df->get('lastModified'),
|
||||
'... form in list mode does not return lastModified'
|
||||
);
|
||||
$dform->{_mode} = 'form';
|
||||
cmp_ok(
|
||||
$dform->getContentLastModified,
|
||||
'>',
|
||||
$dform->get('lastModified'),
|
||||
'... form with a captcha does not return lastModified, even in form mode'
|
||||
);
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue