X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FInterface%2FWeb.pm;fp=rt%2Flib%2FRT%2FInterface%2FWeb.pm;h=af41e5ba6492cde95b4b7d189fcabb41750aeb2e;hp=f26afde35b920ebcae537d3f65ff621d5fd63a98;hb=de9d037528895f7151a9aead6724ce2df95f9586;hpb=b226bc6bd81f999176cdbfa53a799033ff0a0307 diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm index f26afde35..af41e5ba6 100644 --- a/rt/lib/RT/Interface/Web.pm +++ b/rt/lib/RT/Interface/Web.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -1436,7 +1436,7 @@ sub IsCompCSRFWhitelisted { # golden. This acts on the presumption that external forms may # hardcode a username and password -- if a malicious attacker knew # both already, CSRF is the least of your problems. - my $AllowLoginCSRF = not RT->Config->Get('RestrictReferrerLogin'); + my $AllowLoginCSRF = not RT->Config->Get('RestrictLoginReferrer'); if ($AllowLoginCSRF and defined($args{user}) and defined($args{pass})) { my $user_obj = RT::CurrentUser->new(); $user_obj->Load($args{user}); @@ -1653,7 +1653,7 @@ sub MaybeShowInterstitialCSRFPage { my $token = StoreRequestToken($ARGS); $HTML::Mason::Commands::m->comp( '/Elements/CSRF', - OriginalURL => RT->Config->Get('WebPath') . $HTML::Mason::Commands::r->path_info, + OriginalURL => RT->Config->Get('WebBaseURL') . RT->Config->Get('WebPath') . $HTML::Mason::Commands::r->path_info, Reason => HTML::Mason::Commands::loc( $msg, @loc ), Token => $token, ); @@ -3099,6 +3099,9 @@ sub ProcessObjectCustomFieldUpdates { $Object = $class->new( $session{'CurrentUser'} ) unless $Object && ref $Object eq $class; + # skip if we have no object to update + next unless $id || $Object->id; + $Object->Load($id) unless ( $Object->id || 0 ) == $id; unless ( $Object->id ) { $RT::Logger->warning("Couldn't load object $class #$id"); @@ -3150,14 +3153,21 @@ sub ProcessObjectCustomFieldUpdates { sub _ParseObjectCustomFieldArgs { my $ARGSRef = shift || {}; + my %args = ( + IncludeBulkUpdate => 0, + @_, + ); my %custom_fields_to_mod; foreach my $arg ( keys %$ARGSRef ) { # format: Object---CustomField[:]-- - # or: Bulk--CustomField[:]-- # you can use GetCustomFieldInputName to generate the complement input name - next unless $arg =~ /^(?:Bulk-(?:Add|Delete)|Object-([\w:]+)-(\d*))-CustomField(?::(\w+))?-(\d+)-(.*)$/; + # or if IncludeBulkUpdate: Bulk--CustomField[:]-- + next unless $arg =~ /^Object-([\w:]+)-(\d*)-CustomField(?::(\w+))?-(\d+)-(.*)$/ + || ($args{IncludeBulkUpdate} && $arg =~ /^Bulk-(?:Add|Delete)-()()CustomField(?::(\w+))?-(\d+)-(.*)$/); + # need two empty groups because we must consume $1 and $2 with empty + # class and ID next if $1 eq 'RT::Transaction';# don't try to update transaction fields