Ejemplo n.º 1
0
$gui = initializeGui();
$op = doDBConnect($db);
if ($op['status'] == 0) {
    $smarty = new TLSmarty();
    $gui->title = lang_get('fatal_page_title');
    $gui->msg = $op['dbms_msg'];
    $smarty->display('fatal_error.tpl');
    exit;
}
if ($args->login != "" && !$gui->external_password_mgmt) {
    $userID = tlUser::doesUserExist($db, $args->login);
    if (!$userID) {
        $gui->note = lang_get('bad_user');
    } else {
        $user = new tlUser($userID);
        $result = $user->resetPassword($db);
        $gui->note = $result['msg'];
        if ($result['status'] >= tl::OK) {
            if ($user->readFromDB($db) >= tl::OK) {
                logAuditEvent(TLS("audit_pwd_reset_requested", $user->login), "PWD_RESET", $userID, "users");
            }
            redirect(TL_BASE_HREF . "login.php?note=lost");
            exit;
        } else {
            if ($result['status'] == tlUser::E_EMAILLENGTH) {
                $gui->note = lang_get('mail_empty_address');
            } else {
                if ($note != "") {
                    $gui->note = tlUser::getUserErrorMessage($result['status']);
                }
            }