Das Modul ist nur für Contenido V4.6.x ff geeignet. Es ist außerdem "on-the-fly" gecoded, wenn es also nicht auf Anhieb funktioniert - tschuldigung (Bananen-Software). Ich hübsche das Ganze auch nochmal bei Gelegenheit, die CSS-Styles fehlen und die Übersetzung muss man zunächst selbst vornehmen...
Das Modul muss bei einem Artikel eingesetzt werden, der sich in einer geschützen Kategorie befindet. Alle Frontendnutzer sollten Zugriff auf diese Kategorie haben.
Beschreibung:
Code: Alles auswählen
Change Password 1.1
HerrB, 17.11.2005
Code: Alles auswählen
<?php
cInclude("classes", "class.frontend.users.php");
$frontendusers = new FrontendUserCollection;
$frontendusers->select("idclient = '$client' AND username = '".urlencode($auth->auth[uname])."'");
if ($frontenduser = $frontendusers->next()) {
$idfrontend = $frontenduser->get("idfrontenduser");
$strMsg = "";
if ($_REQUEST["action"] == "save") {
if ($_REQUEST["oldpw"] != "" || $_REQUEST["newpw1"] != "" || $_REQUEST["newpw2"] != "") {
if ($_REQUEST["oldpw"] == "") {
$strMsg = mi18n("If changing the password please provide the current password.");
} else if ($_REQUEST["newpw1"] == "" || $_REQUEST["newpw2"] == "") {
$strMsg = mi18n("If changing the password please specify new password and retype the new password to avoid typos.");
} else if (md5($_REQUEST["oldpw"]) != $frontenduser->get("password")) {
$strMsg = mi18n("Old password is wrong.");
} else if ($_REQUEST["newpw1"] != $_REQUEST["newpw2"]) {
$strMsg = mi18n("If changing the password the new password and the retyped new password must be equal.");
} else if (strlen($_REQUEST["newpw1"]) > 24) {
$strMsg = mi18n("If changing the password please specify a new password with 24 characters max..");
} else if (strlen($_REQUEST["newpw1"]) < 6) {
$strMsg = mi18n("If changing the password please specify a new password with at least 6 characters.");
}
}
if ($strMsg == "" && $_REQUEST["oldpw"] != "") {
$frontenduser->set("password", $_REQUEST["newpw1"]);
$frontenduser->store();
$strMsg = mi18n("Changes has been saved.");
} else {
$strMsg = '<font color="#FF0000">'.$strMsg.'</font>';
}
}
echo '<form name="frmProfile" method="post" action="'.$auth->url().'">',chr(10);
echo ' <table class="special" cellspacing="0"> ',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="detail_headline" colspan="2">'.mi18n("Change Password:").'</td>',chr(10);
echo ' </tr>',chr(10);
if ($strMsg != "") {
echo ' <tr>',chr(10);
echo ' <td class="detail_text" colspan="2">'.$strMsg.'</td>',chr(10);
echo ' </tr>',chr(10);
}
echo ' <tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="detail_text" style="width: 100px;">'.mi18n("Old password:").'</td>',chr(10);
echo ' <td class="detail_text"><input name="oldpw" type="password" size="24" maxlength="24"></td>',chr(10);
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="detail_text" style="width: 100px;">'.mi18n("New password:").'</td>',chr(10);
echo ' <td class="detail_text"><input name="newpw1" type="password" size="24" maxlength="24"></td>',chr(10);
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="detail_text" style="width: 100px;">'.mi18n("Retype password:").'</td>',chr(10);
echo ' <td class="detail_text"><input name="newpw2" type="password" size="24" maxlength="24"></td>',chr(10);
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="detail_text" style="width: 100px;"> </td>',chr(10);
echo ' <td class="detail_text"><input type="hidden" name="action" value="save"><input class="submit" name="subscribe" type="submit" id="subscribe" value="'.mi18n("OK").'"></td>',chr(10);
echo ' </tr>',chr(10);
echo ' </table>',chr(10);
echo '</form>',chr(10);
}
?>
HerrB