Some fixes
* Remove list.clone (unused) and scalar.substr (standard) methods * Show only real stack trace in ThrowTemplateError * Move constants out of Bugzilla::User to solve issues with circular use'shinted-selects
parent
a49bc67962
commit
9de760790c
|
@ -17,7 +17,6 @@
|
|||
package Bugzilla::Auth::Login;
|
||||
|
||||
use strict;
|
||||
use fields qw();
|
||||
|
||||
# Determines whether or not a user can logout. It's really a subroutine,
|
||||
# but we implement it here as a constant. Override it in subclasses if
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
package Bugzilla::Auth::Persist::Cookie;
|
||||
use strict;
|
||||
use fields qw();
|
||||
|
||||
use Bugzilla::Constants;
|
||||
use Bugzilla::Util;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package Bugzilla::Auth::Verify;
|
||||
|
||||
use strict;
|
||||
use fields qw();
|
||||
|
||||
use Bugzilla::Constants;
|
||||
use Bugzilla::Error;
|
||||
|
|
|
@ -40,6 +40,7 @@ BEGIN
|
|||
|
||||
use CGI qw(-no_xhtml -oldstyle_urls :private_tempfiles :unique_headers SERVER_PUSH);
|
||||
use base qw(CGI);
|
||||
use CGI::Cookie;
|
||||
|
||||
# We need to disable output buffering - see bug 179174
|
||||
$| = 1;
|
||||
|
|
|
@ -184,6 +184,11 @@ use Cwd qw(abs_path);
|
|||
|
||||
BUG_ID_ADD_TO_BLOCKED
|
||||
BUG_ID_ADD_TO_DEPENDSON
|
||||
|
||||
USER_MATCH_MULTIPLE
|
||||
USER_MATCH_FAILED
|
||||
USER_MATCH_SUCCESS
|
||||
MATCH_SKIP_CONFIRM
|
||||
);
|
||||
|
||||
@Bugzilla::Constants::EXPORT_OK = qw(contenttypes);
|
||||
|
@ -249,6 +254,11 @@ use constant AUTH_LOCKOUT => 6;
|
|||
# The minimum length a password must have.
|
||||
use constant USER_PASSWORD_MIN_LENGTH => 6;
|
||||
|
||||
use constant USER_MATCH_MULTIPLE => -1;
|
||||
use constant USER_MATCH_FAILED => 0;
|
||||
use constant USER_MATCH_SUCCESS => 1;
|
||||
use constant MATCH_SKIP_CONFIRM => 1;
|
||||
|
||||
use constant LOGIN_OPTIONAL => 0;
|
||||
use constant LOGIN_NORMAL => 1;
|
||||
use constant LOGIN_REQUIRED => 2;
|
||||
|
|
|
@ -23,7 +23,7 @@ use Data::Dumper;
|
|||
|
||||
use overload '""' => sub { $_[0]->{message} };
|
||||
|
||||
my $HAVE_DEVEL_STACKTRACE = eval { require Devel::StackTrace };
|
||||
our $HAVE_DEVEL_STACKTRACE = eval { require Devel::StackTrace };
|
||||
|
||||
our $IN_EVAL = 0;
|
||||
|
||||
|
@ -286,7 +286,8 @@ sub ThrowCodeError
|
|||
sub ThrowTemplateError
|
||||
{
|
||||
my ($template_err) = @_;
|
||||
_throw_error('code', 'template_error', { template_error_msg => "$template_err" });
|
||||
my ($msg, $stack) = split /\n{2,}/, "$template_err";
|
||||
_throw_error('code', 'template_error', { template_error_msg => $msg, stack_trace => $stack });
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -532,12 +532,6 @@ sub get_bug_link
|
|||
# If you do not re-run checksetup.pl, the change you make will not apply
|
||||
$Template::Directive::WHILE_MAX = 1000000;
|
||||
|
||||
# Use the Toolkit Template's Stash module to add utility pseudo-methods
|
||||
# to template variables.
|
||||
use Template::Stash::XS;
|
||||
|
||||
$Template::Config::STASH = 'Template::Stash::XS';
|
||||
|
||||
# Allow keys to start with an underscore or a dot.
|
||||
$Template::Stash::PRIVATE = undef;
|
||||
|
||||
|
@ -553,31 +547,17 @@ $Template::Stash::LIST_OPS->{contains} = sub
|
|||
$Template::Stash::LIST_OPS->{containsany} = sub
|
||||
{
|
||||
my ($list, $items) = @_;
|
||||
foreach my $item (@$items) {
|
||||
foreach my $item (@$items)
|
||||
{
|
||||
return 1 if grep($_ eq $item, @$list);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
# Clone the array reference to leave the original one unaltered.
|
||||
$Template::Stash::LIST_OPS->{clone} = sub
|
||||
{
|
||||
my $list = shift;
|
||||
return [@$list];
|
||||
};
|
||||
|
||||
# Allow us to still get the scalar if we use the list operation ".0" on it,
|
||||
# as we often do for defaults in query.cgi and other places.
|
||||
$Template::Stash::SCALAR_OPS->{0} = sub { $_[0] };
|
||||
|
||||
# Add a "substr" method to the Template Toolkit's "scalar" object
|
||||
# that returns a substring of a string.
|
||||
$Template::Stash::SCALAR_OPS->{substr} = sub
|
||||
{
|
||||
my ($scalar, $offset, $length) = @_;
|
||||
return substr($scalar, $offset, $length);
|
||||
};
|
||||
|
||||
# Add a "truncate" method to the Template Toolkit's "scalar" object
|
||||
# that truncates a string to a certain length.
|
||||
$Template::Stash::SCALAR_OPS->{truncate} = sub
|
||||
|
|
|
@ -59,19 +59,12 @@ use base qw(Bugzilla::Object Exporter);
|
|||
# FIXME Remove procedural APIs
|
||||
@Bugzilla::User::EXPORT = qw(
|
||||
is_available_username login_to_id validate_password
|
||||
USER_MATCH_MULTIPLE USER_MATCH_FAILED USER_MATCH_SUCCESS MATCH_SKIP_CONFIRM
|
||||
);
|
||||
|
||||
#####################################################################
|
||||
# Constants
|
||||
#####################################################################
|
||||
|
||||
use constant USER_MATCH_MULTIPLE => -1;
|
||||
use constant USER_MATCH_FAILED => 0;
|
||||
use constant USER_MATCH_SUCCESS => 1;
|
||||
|
||||
use constant MATCH_SKIP_CONFIRM => 1;
|
||||
|
||||
use constant DEFAULT_USER => {
|
||||
'userid' => 0,
|
||||
'realname' => '',
|
||||
|
|
Loading…
Reference in New Issue