Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php
12256 views
1
<?php
2
3
final class PhabricatorAuthTemporaryTokenRevoker
4
extends PhabricatorAuthRevoker {
5
6
const REVOKERKEY = 'temporary';
7
8
public function getRevokerName() {
9
return pht('Temporary Tokens');
10
}
11
12
public function getRevokerDescription() {
13
return pht(
14
"Revokes temporary authentication tokens.\n\n".
15
"Temporary tokens are used in password reset mail, welcome mail, and ".
16
"by some other systems like Git LFS. Revoking temporary tokens will ".
17
"invalidate existing links in password reset and invite mail that ".
18
"was sent before the revocation occurred.");
19
}
20
21
public function revokeAllCredentials() {
22
$table = new PhabricatorAuthTemporaryToken();
23
$conn = $table->establishConnection('w');
24
25
queryfx(
26
$conn,
27
'DELETE FROM %T',
28
$table->getTableName());
29
30
return $conn->getAffectedRows();
31
}
32
33
public function revokeCredentialsFrom($object) {
34
$table = new PhabricatorAuthTemporaryToken();
35
$conn = $table->establishConnection('w');
36
37
queryfx(
38
$conn,
39
'DELETE FROM %T WHERE tokenResource = %s',
40
$table->getTableName(),
41
$object->getPHID());
42
43
return $conn->getAffectedRows();
44
}
45
46
}
47
48