* * @copyright 2004-2016 The Admidio Team * @see http://www.admidio.org/ * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only * * Parameters: * * aid .. Activation id for confirmation of new password * usr_id .. Id of the user who wants a new password *********************************************************************************************** */ require_once 'common.php'; // Initialize and check the parameters $getActivationId = admFuncVariableIsValid($_GET, 'aid', 'string', array('requireValue' => true)); $getUserId = admFuncVariableIsValid($_GET, 'usr_id', 'int', array('requireValue' => true)); // Systemmails und Passwort zusenden muessen aktiviert sein if ($gPreferences['enable_system_mails'] != 1 || $gPreferences['enable_password_recovery'] != 1) { $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } $user = new TableUsers($gDb, $getUserId); if ($user->getValue('usr_activation_code') === $getActivationId) { // activate the new password $user->setPassword($user->getValue('usr_new_password'), false, false); $user->setPassword('', true, false); $user->setValue('usr_activation_code', ''); $user->save(); $gMessage->setForwardUrl($g_root_path . '/adm_program/system/login.php', 2000); $gMessage->show($gL10n->get('SYS_PWACT_PW_SAVED')); } else { $gMessage->show($gL10n->get('SYS_PWACT_CODE_INVALID')); }
if ($gDbType === 'postgresql') { // soundex is not a default function in PostgreSQL $sql = 'UPDATE ' . TBL_PREFERENCES . ' SET prf_value = \'0\' WHERE prf_name LIKE \'system_search_similar\''; $db->query($sql); } // create new organization $gCurrentOrganization = new Organization($db, $_SESSION['orga_shortname']); $gCurrentOrganization->setValue('org_longname', $_SESSION['orga_longname']); $gCurrentOrganization->setValue('org_shortname', $_SESSION['orga_shortname']); $gCurrentOrganization->setValue('org_homepage', $_SERVER['HTTP_HOST']); $gCurrentOrganization->save(); // create user webmaster and assign roles $webmaster = new TableUsers($db); $webmaster->setValue('usr_login_name', $_SESSION['user_login']); $webmaster->setPassword($_SESSION['user_password']); $webmaster->setValue('usr_usr_id_create', $gCurrentUser->getValue('usr_id')); $webmaster->setValue('usr_timestamp_create', DATETIME_NOW); $webmaster->save(false); // no registered user -> UserIdCreate couldn't be filled // write all preferences from preferences.php in table adm_preferences require_once 'db_scripts/preferences.php'; // set some specific preferences whose values came from user input of the installation wizard $orga_preferences['email_administrator'] = $_SESSION['orga_email']; $orga_preferences['system_language'] = $language; // calculate the best cost value for your server performance $benchmarkResults = PasswordHashing::costBenchmark(); $orga_preferences['system_hashing_cost'] = $benchmarkResults['cost']; // create all necessary data for this organization $gCurrentOrganization->setPreferences($orga_preferences, false); $gCurrentOrganization->createBasicData($webmaster->getValue('usr_id'));