示例#1
0
/**
 * Function called for changing user attributes
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _ppolicy_changeUser($FH, $mode)
{
    global $result;
    $uid = $FH->getPostValue("uid");
    $updated = False;
    if ($mode == "edit") {
        if ($FH->isUpdated("pwdLock")) {
            if ($FH->getValue("pwdLock") == "on") {
                lockAccount($uid);
            } else {
                unlockAccount($uid);
            }
        }
    }
    if ($FH->isUpdated("ppolicyname")) {
        $ppolicyName = $FH->getValue("ppolicyname");
        if ($ppolicyName) {
            updateUserPPolicy($uid, $ppolicyName);
            $result .= sprintf(_T("Password policy %s applied.", "ppolicy"), $ppolicyName) . "<br />";
        } else {
            removeUserPPolicy($uid);
            $result .= sprintf(_T("Password policy %s removed.", "ppolicy"), $ppolicyName) . "<br />";
        }
    }
    /* Handle special pwdReset case, which doesn't require the PPolicy
       object class */
    if ($FH->isUpdated('pwdReset')) {
        if ($FH->getValue('pwdReset') == "off") {
            setUserPPolicyAttribut($uid, 'pwdReset', 'FALSE');
        } else {
            setUserPPolicyAttribut($uid, 'pwdReset', 'TRUE');
        }
        $result .= _T("Password policy attributes updated.", "ppolicy") . "<br />";
    }
    return 0;
}
 if (lg_debug) {
     $dbMsg .= "userid: " . $userid . "<br>\n";
 }
 if (lg_debug) {
     $dbMsg .= "email: " . $email . "<br>\n";
 }
 if (lg_debug) {
     $dbMsg .= "locked: " . $locked . "<br>\n";
 }
 if (lg_debug) {
     $dbMsg .= "dateLocked: " . $dateLocked . "<br>\n";
 }
 /*******************************************************************************************************************
  * Unlock the account - set token->Null, dateLocked->Null, locked->0
  *******************************************************************************************************************/
 unlockAccount($token, $locked, $dateLocked, $id);
 if (lg_debug) {
     $dbMsg .= "Unlock account: numAffected " . $numAffected . "<br>\n";
 }
 $message = "<h2>" . lg_phrase_verify_verified . "</h2><br><br>";
 $message .= lg_phrase_verify_login . "<br>";
 $message .= '<div id="details">' . lg_term_userid . ": " . $userid . "<br>";
 $message .= lg_term_email . ": " . $email . "<br>";
 //if (lg_debug) { $dbMsg .= "message: ".$message."<br>\n"; }
 if ($destination != "") {
     if (lg_debug) {
         $dbMsg .= "destination not empty: " . $destination . "<br>\n";
     }
     $message .= '<p><a href="' . $destination . '" title="' . lg_phrase_logout_continue . '">' . lg_phrase_logout_continue . "</a></p>";
 } else {
     $message .= '<p><a href="' . lg_loginPage . '" title="' . lg_phrase_logout_continue . '">' . lg_phrase_logout_continue . "</a></p>";