function _process() { global $osC_MessageStack, $osC_Database, $osC_Language; $Qcheck = $osC_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS); $Qcheck->bindValue(':customers_email_address', $_POST['email_address']); $Qcheck->execute(); if ($Qcheck->numberOfRows() === 1) { $password = osc_create_random_string(ACCOUNT_PASSWORD); if (osC_Account::savePassword($password, $Qcheck->valueInt('customers_id'))) { if (ACCOUNT_GENDER > -1) { if ($data['gender'] == 'm') { $email_text = sprintf($osC_Language->get('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } else { $email_text = sprintf($osC_Language->get('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } } else { $email_text = sprintf($osC_Language->get('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } $email_text .= sprintf($osC_Language->get('email_password_reminder_body'), getenv('REMOTE_ADDR'), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS); osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf($osC_Language->get('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); $osC_MessageStack->add('login', $osC_Language->get('success_password_forgotten_sent'), 'success'); } osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } else { $osC_MessageStack->add('password_forgotten', $osC_Language->get('error_password_forgotten_no_email_address_found')); } }
function _process() { global $messageStack, $osC_Database, $osC_Language; $Qcheck = $osC_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS); $Qcheck->bindValue(':customers_email_address', $_POST['email_address']); $Qcheck->execute(); if ($Qcheck->numberOfRows() === 1) { $password = osc_create_random_string(ACCOUNT_PASSWORD); if (osC_Account::savePassword($password, $Qcheck->valueInt('customers_id'))) { include 'includes/classes/email_template.php'; $email_template = toC_Email_Template::getEmailTemplate('password_forgotten'); $email_template->setData($Qcheck->valueProtected('customers_firstname'), $Qcheck->valueProtected('customers_lastname'), getenv('REMOTE_ADDR'), $password, $Qcheck->valueProtected('customers_gender'), $Qcheck->valueProtected('customers_email_address')); $email_template->buildMessage(); $email_template->sendEmail(); $messageStack->add_session('login', $osC_Language->get('success_password_forgotten_sent'), 'success'); } osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } else { $messageStack->add('password_forgotten', $osC_Language->get('error_password_forgotten_no_email_address_found')); } }
function _process() { global $messageStack, $osC_Database, $osC_Language; if (!isset($_POST['password_current']) || strlen(trim($_POST['password_current'])) < ACCOUNT_PASSWORD) { $messageStack->add('account_password', sprintf($osC_Language->get('field_customer_password_current_error'), ACCOUNT_PASSWORD)); } elseif (!isset($_POST['password_new']) || strlen(trim($_POST['password_new'])) < ACCOUNT_PASSWORD) { $messageStack->add('account_password', sprintf($osC_Language->get('field_customer_password_new_error'), ACCOUNT_PASSWORD)); } elseif (!isset($_POST['password_confirmation']) || trim($_POST['password_new']) != trim($_POST['password_confirmation'])) { $messageStack->add('account_password', $osC_Language->get('field_customer_password_new_mismatch_with_confirmation_error')); } if ($messageStack->size('account_password') === 0) { if (osC_Account::checkPassword(trim($_POST['password_current']))) { if (osC_Account::savePassword(trim($_POST['password_new']))) { $messageStack->add_session('account', $osC_Language->get('success_password_updated'), 'success'); osc_redirect(osc_href_link(FILENAME_ACCOUNT, null, 'SSL')); } else { $messageStack->add('account_password', sprintf($osC_Language->get('field_customer_password_new_error'), ACCOUNT_PASSWORD)); } } else { $messageStack->add('account_password', $osC_Language->get('error_current_password_not_matching')); } } }