hi,
die lampe zeigt grün. hier mal der code
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Passwort ändern
* Author(s) : HerrB
* Copyright : HerrB
* Created : 31.03.2006
************************************************/
cInclude("classes", "class.frontend.users.php");
cInclude("classes", "contenido/class.user.php");
if (is_numeric($auth->auth["uid"])) {
// Only exec anything, if we are a logged-in-frontend user
// Frontenduser
$oFrontendUser = new FrontendUser;
$oFrontendUser->loadByPrimaryKey($auth->auth["uid"]);
$strMsg = "";
if ($_REQUEST["action"] == "save") {
if ($_REQUEST["oldpw"] != "" || $_REQUEST["newpw1"] != "" || $_REQUEST["newpw2"] != "") {
if ($_REQUEST["oldpw"] == "") {
$strMsg = mi18n("Um ein neues Passwort zu vergeben, geben Sie bitte erst das alte Passwort ein.");
} else if ($_REQUEST["newpw1"] == "" || $_REQUEST["newpw2"] == "") {
$strMsg = mi18n("Geben Sie ein neues Passwort ein und wiederholen Sie es um Schreibfehler auszuschließen.");
} else if (md5($_REQUEST["oldpw"]) != $oFrontendUser->get("password")) {
$strMsg = mi18n("Das alte Passwort ist falsch.");
} else if ($_REQUEST["newpw1"] != $_REQUEST["newpw2"]) {
$strMsg = mi18n("Das wiederholte Passwort stimmt nicht mit dem neuem Passwort überein.");
} else if (strlen($_REQUEST["newpw1"]) > 24) {
$strMsg = mi18n("Das neue Passwort darf max. 24 Zeichen lang sein.");
} else if (strlen($_REQUEST["newpw1"]) < 6) {
$strMsg = mi18n("Das neue Passwort muss aus mindestens 6 Zeichen bestehen.");
}
}
if ($strMsg == "" && $_REQUEST["oldpw"] != "") {
// Update frontend and backend password
$oFrontendUser->set("password", $_REQUEST["newpw1"]);
$oFrontendUser->store();
// Backenduser
$oBackendUser = new cApiUser(md5($auth->auth["uname"]));
if ($oBackendUser) {
// This is a possible security hole, if a backend user has the right to edit frontend users: He may specify a frontend user as named as an admin (backend account) and may reset his passwort using this module -> Only give certain people the right to edit frontend users...
$oBackendUser->set("password", md5($_REQUEST["newpw1"])); // Has to be md5, as class lacks a suitable store() method
$oBackendUser->store();
}
$strMsg = mi18n("Änderungen wurden gespeichert.");
} else {
$strMsg = '<font color="#FF0000">'.$strMsg.'</font>';
}
}
echo '<H2>Passwort ändern</H2>';
echo '<form name="frmProfile" method="post" action="'.$auth->url().'">';
echo '<table cellspacing="0" border="0">';
echo '<tr>';
echo ' <td>'.mi18n("altes Passwort:").'</td>';
echo ' <td><input name="oldpw" type="password" size="24" maxlength="24"></td>';
echo '</tr>';
echo '<tr>';
echo ' <td>'.mi18n("neues Passwort:").'</td>';
echo ' <td><input name="newpw1" type="password" size="24" maxlength="24"></td>';
echo '</tr>';
echo '<tr>';
echo ' <td>'.mi18n("neues Passwort wiederholen:").'</td>';
echo ' <td><input name="newpw2" type="password" size="24" maxlength="24"></td>';
echo '</tr>';
if ($strMsg != "")
{
echo '<tr>';
echo ' <td colspan="2">'.$strMsg.'</td>';
echo '</tr>';
}
echo '<tr>';
echo ' <td colspan="2" align="right">';
echo ' <input type="button" value="zurück" onclick="javascript:history.back()">';
echo ' <input type="hidden" name="action" value="save">';
echo ' <input class="submit" name="subscribe" type="submit" id="subscribe" value="'.mi18n("speichern").'">';
echo ' </td>';
echo '</tr>';
echo '</table>';
echo '</form>';
}
?>