From 421ff7f194875db9634ea783d9dd5b6111f19df3 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 1 Sep 2015 13:01:20 +0800 Subject: Bug 1197073 - add support for 2fa using totp (eg. google authenticator) --- Bugzilla/Token.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Bugzilla/Token.pm') diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index b7227144f..6e1414db6 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -219,11 +219,12 @@ sub IssuePasswordToken { } sub issue_session_token { + my ($data, $user) = @_; # Generates a random token, adds it to the tokens table, and returns # the token to the caller. - my $data = shift; - return _create_token(Bugzilla->user->id, 'session', $data); + $user //= Bugzilla->user; + return _create_token($user->id, 'session', $data); } sub issue_hash_token { @@ -657,12 +658,14 @@ although they can be used separately. =over -=item C +=item C Description: Creates and returns a token used internally. Params: $event - The event which needs to be stored in the DB for future reference/checks. + $user - The user to bind the token with. Uses the current user + if not provided. Returns: A unique token. -- cgit v1.2.3-24-g4f1b