summaryrefslogtreecommitdiffstats
path: root/Token.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Token.pm')
-rw-r--r--Token.pm21
1 files changed, 11 insertions, 10 deletions
diff --git a/Token.pm b/Token.pm
index c8132b804..97d2da41d 100644
--- a/Token.pm
+++ b/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 {