summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-01-29 18:33:12 +0100
committerDavid Lawrence <dkl@mozilla.com>2015-01-29 18:33:12 +0100
commitc8447e9f4b7c17ab0e04af34dbd5583e78b23677 (patch)
tree573093df276637e98796717c325c3fc5c040263d /Bugzilla/Template.pm
parent89d319922df1160f346321acfa6a9c5d69b5ed43 (diff)
downloadbugzilla-c8447e9f4b7c17ab0e04af34dbd5583e78b23677.tar.gz
bugzilla-c8447e9f4b7c17ab0e04af34dbd5583e78b23677.tar.xz
Bug 1045145: backport upstream bug 726696 to bmo/4.2 to allow use of api keys for authentication
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index be84bc66a..9f007bb6d 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -1038,6 +1038,12 @@ sub create {
# Allow templates to generate a token themselves.
'issue_hash_token' => \&Bugzilla::Token::issue_hash_token,
+ 'get_api_token' => sub {
+ return '' unless Bugzilla->user->id;
+ my $cache = Bugzilla->request_cache;
+ return $cache->{api_token} //= issue_api_token();
+ },
+
# A way for all templates to get at Field data, cached.
'bug_fields' => sub {
my $cache = Bugzilla->request_cache;