示例#1
0
<?php

include "env.php";
include APP_PATH . "/Bootstrap.php";
$contact = null;
// TODO: Is this page still relevant? Maybe use the token for quick authentication?
$contactId = Utils::getParam('c');
$identifier = Utils::getParam('i');
$contact = AuthHandler::authByVerification($contactId, $identifier);
if ($contact) {
    try {
        Service_DeleteUser::run(AuthHandler::getLoggedInUserId());
        GlobalMessage::setGlobalMessage(_('Contact successfully deleted.'), GlobalMessage::INFO);
    } catch (Exception $e) {
        GlobalMessage::setGlobalMessage(_('Deletion failed') . ': ' . _('Internal error.'), GlobalMessage::ERROR);
    }
} else {
    GlobalMessage::setGlobalMessage(_('Deletion failed') . ': ' . _('Authentication failed.'), GlobalMessage::ERROR);
}
AuthHandler::logout();
Utils::redirect('index.php');
示例#2
0
<?php

include "../env.php";
include APP_PATH . "/Bootstrap.php";
if (ENV !== ENV_DEVELOPMENT && !Utils::IsXhrRequest()) {
    die;
}
$action = 'deleted';
$contactId = AuthHandler::getLoggedInUserId();
if (!$contactId) {
    warn("Delete command sent while no user is logged in");
    die;
}
try {
    Service_DeleteUser::run($contactId);
    GlobalMessage::setGlobalMessage(_("Ride deleted. Happy now?"));
    echo json_encode(array('status' => 'ok', 'action' => $action));
} catch (Exception $e) {
    logException($e);
    echo json_encode(array('status' => 'err', 'action' => $action));
}