Ejemplo n.º 1
0
        // add user to web groups
        if (count($groups) > 0) {
            $ds = $modx->dbQuery("SELECT id FROM " . $modx->getFullTableName("webgroup_names") . " WHERE name IN ('" . implode("','", $groups) . "')");
            if (!$ds) {
                return $modx->webAlert('An error occured while attempting to update user\'s web groups');
            } else {
                while ($row = $modx->fetchRow($ds)) {
                    $wg = $row["id"];
                    $modx->dbQuery("REPLACE INTO " . $modx->getFullTableName("web_groups") . " (webgroup,webuser) VALUES('{$wg}','{$key}')");
                }
            }
        }
        // invoke OnWebSaveUser event
        $modx->invokeEvent("OnWebSaveUser", array("mode" => "new", "userid" => $key, "username" => $username, "userpassword" => $password, "useremail" => $email, "userfullname" => $fullname));
        // send email notification
        $rt = webLoginSendNewPassword($email, $username, $password, $fullname);
        if ($rt !== true) {
            // an error occured
            $output = $rt . $tpl;
            return;
        }
        // display change notification
        $newpassmsg = "A copy of the new password was sent to your email address.";
        $tpl = $tpls[1];
        $tpl = str_replace("[+newpassmsg+]", $newpassmsg, $tpl);
        $output .= $tpl;
    }
}
// Returns Default WebChangePwd tpl
function getWebSignuptpl($useCaptcha)
{
Ejemplo n.º 2
0
         return;
     } else {
         $newpassword = $specifiedpassword;
     }
 } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
     $output = webLoginAlert("You didn't specify a password for this user!") . $tpl;
     return;
 } elseif ($passwordgenmethod == 'g') {
     $newpassword = webLoginGeneratePassword(8);
 } else {
     $output = webLoginAlert("No password generation method specified!") . $tpl;
     return;
 }
 // handle notification
 if ($passwordnotifymethod == 'e') {
     $rt = webLoginSendNewPassword($ds["email"], $ds["username"], $newpassword, $ds["fullname"]);
     if ($rt !== true) {
         // an error occured
         $output = $rt . $tpl;
         return;
     } else {
         $newpassmsg = "A copy of the new password was sent to your email address.";
     }
 } else {
     $newpassmsg = "The new password is <b>" . htmlspecialchars($newpassword, ENT_QUOTES) . "</b>.";
 }
 // save new password to database
 $rt = $modx->changeWebUserPassword($oldpassword, md5($newpassword));
 if ($rt !== true) {
     $output = webLoginAlert("An error occured while saving new password: {$rt}");
     return;