Skip to content

Commit

Permalink
Revert "Use print_form_button() instead of print_small_button()"
Browse files Browse the repository at this point in the history
Trying to detach an Issue from a Changeset always results in
APPLICATION ERROR 2800 - Invalid form security token, even when using
a valid token.

This is because print_form_button() currently does not work with action
URLs generated by plugin_page(), see [1].

So we revert to original behavior of using print_small_button() (as it
was before commit 787eaa8), but keeping
the single form security token implemented in commit
634277d.

This change can be reverted again, once the upstream issue has been
fixed.

Issue #372

[1]: https://mantisbt.org/bugs/view.php?id=28533
  • Loading branch information
dregad committed May 13, 2021
1 parent 634277d commit cf6cbd3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Source/pages/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function( $p_bug_id ) use ( $t_view_bug_threshold ) {
<?php
$t_first = true;
$t_user_id = auth_get_current_user_id();
$t_security_token = form_security_token( 'plugin_Source_detach' );
$t_security_token = form_security_param( 'plugin_Source_detach' );

foreach ( $t_bug_rows as $t_bug_id => $t_bug_row ) {
$t_color_class = html_get_status_css_fg(
Expand Down Expand Up @@ -213,12 +213,11 @@ function( $p_bug_id ) use ( $t_view_bug_threshold ) {
</td>
<?php if ( $t_can_update ) { ?>
<td class="center"><?php
print_form_button(
plugin_page( 'detach' ),
plugin_lang_get( 'detach' ),
array( 'id' => $t_changeset->id, 'bug_id' => $t_bug_id),
$t_security_token,
'btn btn-round btn-white btn-primary btn-sm'
$t_param = array( 'id' => $t_changeset->id, 'bug_id' => $t_bug_id);
print_small_button(
plugin_page( 'detach' )
. '&' . http_build_query( $t_param ) . $t_security_token,
plugin_lang_get( 'detach' )
) ?>
</td>
<?php } ?>
Expand Down

0 comments on commit cf6cbd3

Please sign in to comment.