Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
e181022c
Commit
e181022c
authored
Sep 08, 2014
by
David Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1046126: Do not generate a new API token every time you access a bug-related page
r=sgreen,a=glob
parent
fc4350ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
Token.pm
Bugzilla/Token.pm
+10
-3
No files found.
Bugzilla/Token.pm
View file @
e181022c
...
...
@@ -34,9 +34,16 @@ use parent qw(Exporter);
# Create a token used for internal API authentication
sub
issue_api_token
{
# Generates a random token, adds it to the tokens table, and returns
# the token to the caller.
return
_create_token
(
Bugzilla
->
user
->
id
,
'api_token'
,
''
);
# Generates a random token, adds it to the tokens table if one does not
# already exist, and returns the token to the caller.
my
$dbh
=
Bugzilla
->
dbh
;
my
$user
=
Bugzilla
->
user
;
my
(
$token
)
=
$dbh
->
selectrow_array
(
"
SELECT token FROM tokens
WHERE userid = ? AND tokentype = 'api_token'
AND ("
.
$dbh
->
sql_date_math
(
'issuedate'
,
'+'
,
(
MAX_TOKEN_AGE
*
24
-
12
),
'HOUR'
)
.
") > NOW()"
,
undef
,
$user
->
id
);
return
$token
//
_create_token
(
$user
->
id
,
'api_token'
,
''
);
}
# Creates and sends a token to create a new user account.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment