// nur ausfuehren, wenn E-Mails vom Server unterstuetzt werden // nur an Mitglieder der eigenen Organisation schicken if (!$gCurrentUser->isWebmaster() || $gPreferences['enable_system_mails'] != 1 || $this_orga == false) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } if ($gPreferences['enable_system_mails'] == 1) { try { // neues Passwort generieren und abspeichern $password = PasswordHashing::genRandomPassword(8); $user->setPassword($password); $user->save(); // Mail an den User mit den Loginaten schicken $sysmail = new SystemMail($gDb); $sysmail->addRecipient($user->getValue('EMAIL'), $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME')); $sysmail->setVariable(1, $password); $sysmail->sendSystemMail('SYSMAIL_NEW_PASSWORD', $user); $gMessage->setForwardUrl($gNavigation->getUrl()); $gMessage->show($gL10n->get('SYS_EMAIL_SEND')); } catch (AdmException $e) { $e->showText(); } } } elseif ($getMode === 5) { // Fragen, ob Zugangsdaten verschickt werden sollen $gMessage->setForwardYesNo($g_root_path . '/adm_program/modules/members/members_function.php?usr_id=' . $getUserId . '&mode=4'); $gMessage->show($gL10n->get('MEM_SEND_NEW_LOGIN', $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'))); } elseif ($getMode === 6) { if ($this_orga == true && $other_orga == 0 && $gCurrentUser->isWebmaster()) { // nur Webmaster duerfen dies // User ist NUR Mitglied der aktuellen Orga -> dann fragen, ob Ehemaliger oder ganz loeschen header('Location: ' . $g_root_path . '/adm_program/modules/members/members_function.php?usr_id=' . $getUserId . '&mode=1');
if ($getMode == 2) { // User existiert bereits, ist aber bisher noch kein Mitglied der aktuellen Orga, // deshalb erst einmal Rollen zuordnen und dann spaeter eine Mail schicken $gNavigation->addUrl($g_root_path . '/adm_program/modules/registration/registration_function.php?mode=3&user_id=' . $getUserId . '&new_user_id=' . $getNewUserId); header('Location: ' . $g_root_path . '/adm_program/modules/profile/roles.php?usr_id=' . $getUserId); exit; } if ($getMode == 1 || $getMode == 3) { $gMessage->setForwardUrl($g_root_path . '/adm_program/modules/registration/registration.php'); // nur ausfuehren, wenn E-Mails auch unterstuetzt werden if ($gPreferences['enable_system_mails'] == 1) { try { // Mail an den User schicken, um die Anmeldung bwz. die Zuordnung zur neuen Orga zu bestaetigen $sysmail = new SystemMail($gDb); $sysmail->addRecipient($user->getValue('EMAIL'), $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME')); $sysmail->sendSystemMail('SYSMAIL_REGISTRATION_USER', $user); $gMessage->show($gL10n->get('NWU_ASSIGN_LOGIN_EMAIL', $user->getValue('EMAIL'))); } catch (AdmException $e) { $e->showHtml(); } } else { $gMessage->show($gL10n->get('NWU_ASSIGN_LOGIN_SUCCESSFUL')); } } elseif ($getMode == 4) { try { // delete registration $registrationUser->delete(); } catch (AdmException $e) { $e->showText(); } // return successful delete for XMLHttpRequest
$gMessage->show($gL10n->get('SYS_LOSTPW_EMAIL_ERROR', $_POST['recipient_email'])); } elseif ($count > 1) { $gMessage->show($gL10n->get('SYS_LOSTPW_SEVERAL_EMAIL', $_POST['recipient_email'])); } $row = $pdoStatement->fetch(); $user = new User($gDb, $gProfileFields, $row['usr_id']); // create and save new password and activation id $newPassword = PasswordHashing::genRandomPassword(8); $activationId = PasswordHashing::genRandomPassword(10); $user->setPassword($newPassword, true); $user->setValue('usr_activation_code', $activationId); $sysmail = new SystemMail($gDb); $sysmail->addRecipient($user->getValue('EMAIL'), $user->getValue('FIRST_NAME', 'database') . ' ' . $user->getValue('LAST_NAME', 'database')); $sysmail->setVariable(1, $newPassword); $sysmail->setVariable(2, $g_root_path . '/adm_program/system/password_activation.php?usr_id=' . $user->getValue('usr_id') . '&aid=' . $activationId); $sysmail->sendSystemMail('SYSMAIL_ACTIVATION_LINK', $user); $user->saveChangesWithoutRights(); $user->save(); $gMessage->setForwardUrl($g_root_path . '/adm_program/system/login.php'); $gMessage->show($gL10n->get('SYS_LOSTPW_SEND', $_POST['recipient_email'])); } catch (AdmException $e) { $e->showHtml(); } } else { /*********************HTML_PART*******************************/ // create html page object $page = new HtmlPage($headline); // add back link to module menu $lostPasswordMenu = $page->getMenu(); $lostPasswordMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png'); $page->addHtml('<p class="lead">' . $gL10n->get('SYS_PASSWORD_FORGOTTEN_DESCRIPTION') . '</p>');
/** * Save all changed columns of the recordset in table of database. If it's a new user * than the registration table will also be filled with a new recordset and optional a * notification mail will be send to all users of roles that have the right to confirm registrations * @param bool $updateFingerPrint Default @b true. Will update the creator or editor of the recordset * if table has columns like @b usr_id_create or @b usr_id_changed */ public function save($updateFingerPrint = true) { global $gMessage, $gL10n, $gPreferences; // if new registration is saved then set user not valid if ($this->TableRegistration->isNewRecord()) { $this->setValue('usr_valid', 0); } parent::save($updateFingerPrint); // if new registration is saved then save also record in registration table and send notification mail if ($this->TableRegistration->isNewRecord()) { // save registration record $this->TableRegistration->setValue('reg_org_id', $this->organizationId); $this->TableRegistration->setValue('reg_usr_id', $this->getValue('usr_id')); $this->TableRegistration->setValue('reg_timestamp', DATETIME_NOW); $this->TableRegistration->save(); // send a notification mail to all role members of roles that can approve registrations // therefore the flags system mails and notification mail for roles with approve registration must be activated if ($gPreferences['enable_system_mails'] == 1 && $gPreferences['enable_registration_admin_mail'] == 1 && $this->sendEmail) { $sql = 'SELECT DISTINCT first_name.usd_value as first_name, last_name.usd_value as last_name, email.usd_value as email FROM ' . TBL_ROLES . ', ' . TBL_CATEGORIES . ', ' . TBL_MEMBERS . ', ' . TBL_USERS . ' RIGHT JOIN ' . TBL_USER_DATA . ' email ON email.usd_usr_id = usr_id AND email.usd_usf_id = ' . $this->mProfileFieldsData->getProperty('EMAIL', 'usf_id') . ' AND LENGTH(email.usd_value) > 0 LEFT JOIN ' . TBL_USER_DATA . ' first_name ON first_name.usd_usr_id = usr_id AND first_name.usd_usf_id = ' . $this->mProfileFieldsData->getProperty('FIRST_NAME', 'usf_id') . ' LEFT JOIN ' . TBL_USER_DATA . ' last_name ON last_name.usd_usr_id = usr_id AND last_name.usd_usf_id = ' . $this->mProfileFieldsData->getProperty('LAST_NAME', 'usf_id') . ' WHERE rol_approve_users = 1 AND rol_cat_id = cat_id AND cat_org_id = ' . $this->organizationId . ' AND mem_rol_id = rol_id AND mem_begin <= \'' . DATE_NOW . '\' AND mem_end > \'' . DATE_NOW . '\' AND mem_usr_id = usr_id AND usr_valid = 1 '; $result = $this->db->query($sql); while ($row = $this->db->fetch_array($result)) { // send mail that a new registration is available $sysmail = new SystemMail($this->db); $sysmail->addRecipient($row['email'], $row['first_name'] . ' ' . $row['last_name']); $sysmail->sendSystemMail('SYSMAIL_REGISTRATION_WEBMASTER', $this); } } } }