2020-08-02 02:44:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$HTML->setHTMLTitle("Passwort ändern");
|
2020-08-04 10:00:38 +00:00
|
|
|
$HTML->importSeitenInhalt("pages/HTML/profile.html");
|
2020-08-02 02:44:32 +00:00
|
|
|
|
|
|
|
if(isset($_REQUEST['oldPassword']) || @$_REQUEST['oldPassword'] != "")
|
|
|
|
{
|
|
|
|
$OLDPassword = trim($_REQUEST['oldPassword']);
|
|
|
|
|
|
|
|
if($OLDPassword != "")
|
|
|
|
{
|
2023-08-23 16:16:34 +00:00
|
|
|
if(password_verify($OLDPassword, $_SESSION['PASSWORD']))
|
2020-08-02 02:44:32 +00:00
|
|
|
{
|
2023-08-23 16:16:34 +00:00
|
|
|
if(isset($_REQUEST['newPassword']) && $_REQUEST['newPassword'] != "")
|
2020-08-02 02:44:32 +00:00
|
|
|
{
|
|
|
|
$NewPassword = trim($_REQUEST['newPassword']);
|
|
|
|
|
|
|
|
if($NewPassword != "")
|
|
|
|
{
|
|
|
|
if(isset($_REQUEST['newPasswordRepeate']) || @$_REQUEST['newPasswordRepeate'] != "")
|
|
|
|
{
|
|
|
|
$NewPasswordRepeate = trim($_REQUEST['newPasswordRepeate']);
|
|
|
|
|
|
|
|
if($NewPasswordRepeate != "")
|
|
|
|
{
|
|
|
|
if($NewPasswordRepeate == $NewPassword)
|
|
|
|
{
|
2023-08-23 16:16:34 +00:00
|
|
|
$hash = password_hash($NewPassword, PASSWORD_ARGON2ID);
|
2020-08-02 02:44:32 +00:00
|
|
|
$statement = $RUNTIME['PDO']->prepare('UPDATE auth SET passwordHash = :PasswordHash WHERE UUID = :PrincipalID');
|
2023-08-23 16:16:34 +00:00
|
|
|
$statement->execute(['PasswordHash' => $hash, 'PrincipalID' => $_SESSION['UUID']]);
|
|
|
|
$_SESSION['PASSWORD'] = $hash;
|
2023-08-23 16:16:34 +00:00
|
|
|
$_SESSION['pwChanged'] = true;
|
|
|
|
|
|
|
|
header('Location: index.php?page=password');
|
|
|
|
die();
|
2020-08-02 02:44:32 +00:00
|
|
|
}else{
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", 'Passwörter stimmen nicht überein!');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", 'Bitte gib das Passwort zur bestätigung noch einmal ein!');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", 'Bitte gib das Passwort zur bestätigung noch einmal ein!');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", 'Bitte gebe ein neues Passwort ein!');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", 'Bitte gebe ein neues Passwort ein!');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", 'Das alte Passwort ist nicht richtig!');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", 'Gebe bitte dein Passwort ein.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-23 16:16:35 +00:00
|
|
|
include '../app/OpenSim.php';
|
|
|
|
$opensim = new OpenSim();
|
|
|
|
|
2020-08-04 10:08:41 +00:00
|
|
|
$PartnerName = "";
|
2023-08-23 16:16:35 +00:00
|
|
|
$PartnerUUID = $opensim->getPartner($_SESSION['UUID']);
|
|
|
|
if($PartnerUUID != null)$PartnerName = $opensim->getUserName($PartnerUUID);
|
2020-08-04 10:08:41 +00:00
|
|
|
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%offlineIMSTATE%%", ' ');
|
2023-08-23 16:16:34 +00:00
|
|
|
$HTML->ReplaceSeitenInhalt("%%firstname%%", htmlspecialchars($_SESSION['FIRSTNAME']));
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%lastname%%", htmlspecialchars($_SESSION['LASTNAME']));
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%partner%%", htmlspecialchars($PartnerName));
|
2023-08-23 16:16:35 +00:00
|
|
|
$HTML->ReplaceSeitenInhalt("%%email%%", htmlspecialchars($opensim->getUserMail($_SESSION['UUID'])));
|
2023-08-23 16:16:34 +00:00
|
|
|
$HTML->ReplaceSeitenInhalt("%%listAllResidentsAsJSArray%%", "");
|
|
|
|
|
|
|
|
$pwChanged = false;
|
|
|
|
if(isset($_SESSION['pwChanged'])) {
|
|
|
|
$pwChanged = true;
|
|
|
|
unset($_SESSION['pwChanged']);
|
|
|
|
}
|
|
|
|
$HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", $pwChanged ? 'Neues Passwort gespeichert.' : ' ');
|
2020-08-02 02:44:32 +00:00
|
|
|
|
|
|
|
$HTML->build();
|
|
|
|
echo $HTML->ausgabe();
|
|
|
|
?>
|