register_pipeline('loginRequired'); // if password is not enabled, then no reason to be on this page if (!$customer_data->has(['password'])) { tep_redirect(tep_href_link('index.php')); } // needs to be included earlier to set the success message in the messageStack require "includes/languages/$language/account_password.php"; $page_fields = [ 'password', 'password_confirmation' ]; $message_stack_area = 'account_password'; if (tep_validate_form_action_is('process')) { $password_current = tep_db_prepare_input($_POST['password_current']); $customer_details = $customer_data->process($page_fields); if (!empty($customer_details)) { $check_customer_query = tep_db_query($customer_data->build_read(['password'], 'customers', ['id' => (int)$_SESSION['customer_id']])); $check_customer = tep_db_fetch_array($check_customer_query); if (tep_validate_password($password_current, $customer_data->get('password', $check_customer))) { $customer_data->update(['password' => $customer_data->get('password', $customer_details)], ['id' => (int)$_SESSION['customer_id']]); tep_db_query("UPDATE customers_info SET customers_info_date_account_last_modified = NOW() WHERE customers_info_id = " . (int)$_SESSION['customer_id']); $messageStack->add_session('account', SUCCESS_PASSWORD_UPDATED, 'success'); tep_redirect(tep_href_link('account.php', '', 'SSL')); } else { $messageStack->add($message_stack_area, ERROR_CURRENT_PASSWORD_NOT_MATCHING); } } } $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link('account.php', '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('account_password.php', '', 'SSL')); require 'includes/template_top.php'; ?>
size($message_stack_area) > 0) { echo $messageStack->output($message_stack_area); } echo tep_draw_form('account_password', tep_href_link('account_password.php', '', 'SSL'), 'post', '', true) . tep_draw_hidden_field('action', 'process'); echo tep_draw_hidden_field('username', $customer->get('username'), 'readonly autocomplete="username"'); ?>