2012-06-13 17:52:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController {
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
$ldap_info = id(new PhabricatorUserLDAPInfo())->loadOneWhere(
|
|
|
|
'userID = %d',
|
|
|
|
$user->getID());
|
|
|
|
|
|
|
|
if (!$ldap_info) {
|
|
|
|
return new Aphront400Response();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$request->isDialogFormPost()) {
|
|
|
|
$dialog = new AphrontDialogView();
|
|
|
|
$dialog->setUser($user);
|
|
|
|
$dialog->setTitle('Really unlink account?');
|
|
|
|
$dialog->appendChild(
|
|
|
|
'<p><strong>You will not be able to login</strong> using this account '.
|
|
|
|
'once you unlink it. Continue?</p>');
|
|
|
|
$dialog->addSubmitButton('Unlink Account');
|
2012-08-13 21:37:26 +02:00
|
|
|
$dialog->addCancelButton('/settings/panel/ldap/');
|
2012-06-13 17:52:05 +02:00
|
|
|
|
|
|
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
$ldap_info->delete();
|
|
|
|
|
|
|
|
return id(new AphrontRedirectResponse())
|
2012-08-13 21:37:26 +02:00
|
|
|
->setURI('/settings/panel/ldap/');
|
2012-06-13 17:52:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|