diff options
author | Byron Jones <glob@mozilla.com> | 2015-09-01 07:01:20 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-09-01 07:01:20 +0200 |
commit | 421ff7f194875db9634ea783d9dd5b6111f19df3 (patch) | |
tree | 5806e9f3001fa4f33ba85aa94856b70a7f878cf8 /Bugzilla/Token.pm | |
parent | bcc93f83a64a76cd73501eaefaf5fd073fbc3f0d (diff) | |
download | bugzilla-421ff7f194875db9634ea783d9dd5b6111f19df3.tar.gz bugzilla-421ff7f194875db9634ea783d9dd5b6111f19df3.tar.xz |
Bug 1197073 - add support for 2fa using totp (eg. google authenticator)
Diffstat (limited to 'Bugzilla/Token.pm')
-rw-r--r-- | Bugzilla/Token.pm | 9 |
1 files changed, 6 insertions, 3 deletions
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<issue_session_token($event)> +=item C<issue_session_token($event [, $user])> 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. |