Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F548518
PhabricatorAuthPasswordRevoker.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorAuthPasswordRevoker.php
View Options
<?php
final
class
PhabricatorAuthPasswordRevoker
extends
PhabricatorAuthRevoker
{
const
REVOKERKEY
=
'password'
;
public
function
getRevokerName
()
{
return
pht
(
'Passwords'
);
}
public
function
getRevokerDescription
()
{
return
pht
(
"Revokes all stored passwords.
\n\n
"
.
"Account passwords and VCS passwords (used to access repositories "
.
"over HTTP) will both be revoked. Passwords for any third party "
.
"applications which use shared password infrastructure will also "
.
"be revoked.
\n\n
"
.
"Users will need to reset account passwords, possibly by using the "
.
"
\"
Forgot Password?
\"
link on the login page. They will also need "
.
"to reset VCS passwords.
\n\n
"
.
"Passwords are revoked, not just removed. Users will be unable to "
.
"select the passwords they used previously and must choose new, "
.
"unique passwords.
\n\n
"
.
"Revoking passwords will not terminate outstanding login sessions. "
.
"Use the
\"
session
\"
revoker in conjunction with this revoker to force "
.
"users to login again."
);
}
public
function
getRevokerNextSteps
()
{
return
pht
(
'NOTE: Revoking passwords does not terminate existing sessions which '
.
'were established using the old passwords. To terminate existing '
.
'sessions, run the "session" revoker now.'
);
}
public
function
revokeAllCredentials
()
{
$query
=
new
PhabricatorAuthPasswordQuery
();
return
$this
->
revokeWithQuery
(
$query
);
}
public
function
revokeCredentialsFrom
(
$object
)
{
$query
=
id
(
new
PhabricatorAuthPasswordQuery
())
->
withObjectPHIDs
(
array
(
$object
->
getPHID
()));
return
$this
->
revokeWithQuery
(
$query
);
}
private
function
revokeWithQuery
(
PhabricatorAuthPasswordQuery
$query
)
{
$viewer
=
$this
->
getViewer
();
$passwords
=
$query
->
setViewer
(
$viewer
)
->
withIsRevoked
(
false
)
->
execute
();
$content_source
=
PhabricatorContentSource
::
newForSource
(
PhabricatorDaemonContentSource
::
SOURCECONST
);
$revoke_type
=
PhabricatorAuthPasswordRevokeTransaction
::
TRANSACTIONTYPE
;
$auth_phid
=
id
(
new
PhabricatorAuthApplication
())->
getPHID
();
foreach
(
$passwords
as
$password
)
{
$xactions
=
array
();
$xactions
[]
=
$password
->
getApplicationTransactionTemplate
()
->
setTransactionType
(
$revoke_type
)
->
setNewValue
(
true
);
$editor
=
$password
->
getApplicationTransactionEditor
()
->
setActor
(
$viewer
)
->
setActingAsPHID
(
$auth_phid
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
setContentSource
(
$content_source
)
->
applyTransactions
(
$password
,
$xactions
);
}
return
count
(
$passwords
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:50 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
121884
Default Alt Text
PhabricatorAuthPasswordRevoker.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment