diff options
Diffstat (limited to 'Bugzilla/Token.pm')
-rw-r--r-- | Bugzilla/Token.pm | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index c8132b804..97d2da41d 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -237,16 +237,17 @@ sub Cancel { &::SendSQL("UNLOCK TABLES"); } -sub HasPasswordToken { - # Returns a password token if the user has one. - - my ($userid) = @_; - - &::SendSQL("SELECT token FROM tokens - WHERE userid = $userid AND tokentype = 'password' LIMIT 1"); - my ($token) = &::FetchSQLData(); - - return $token; +sub DeletePasswordTokens { + my ($userid, $reason) = @_; + + my $dbh = Bugzilla->dbh; + my $sth = $dbh->prepare("SELECT token " . + "FROM tokens " . + "WHERE userid=? AND tokentype='password'"); + $sth->execute($userid); + while (my $token = $sth->fetchrow_array) { + Token::Cancel($token, "user_logged_in"); + } } sub HasEmailChangeToken { |