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);
|
2013-01-27 01:17:44 +01:00
|
|
|
$dialog->setTitle(pht('Really unlink account?'));
|
2013-02-09 19:31:09 +01:00
|
|
|
$dialog->appendChild(phutil_tag('p', array(), pht(
|
|
|
|
'You will not be able to login using this account '.
|
|
|
|
'once you unlink it. Continue?')));
|
2013-01-27 01:17:44 +01:00
|
|
|
$dialog->addSubmitButton(pht('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
|
|
|
}
|
|
|
|
|
|
|
|
}
|