summaryrefslogtreecommitdiffstats
path: root/Token.pm
diff options
context:
space:
mode:
authorbbaetz%acm.org <>2003-03-22 13:47:09 +0100
committerbbaetz%acm.org <>2003-03-22 13:47:09 +0100
commit681ce77bc0dc5828eae2bb48471db9e373437e4b (patch)
treea7c8ba0b1e070ea489c96246eca65fc7c36f6235 /Token.pm
parent3f1f4e57809b2e3f42e637a86646e806470faec5 (diff)
downloadbugzilla-681ce77bc0dc5828eae2bb48471db9e373437e4b.tar.gz
bugzilla-681ce77bc0dc5828eae2bb48471db9e373437e4b.tar.xz
Bug 180642 - Move authentication code into a module
r=gerv, justdave a=justdave
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 {