Exemplo n.º 1
0
 function _process()
 {
     global $osC_Database, $osC_Session, $osC_Language, $osC_ShoppingCart, $messageStack, $osC_Customer, $osC_NavigationHistory, $toC_Wishlist;
     if (osC_Account::checkEntry($_POST['email_address'])) {
         if (osC_Account::checkPassword($_POST['password'], $_POST['email_address'])) {
             if (osC_Account::checkStatus($_POST['email_address'])) {
                 if (SERVICE_SESSION_REGENERATE_ID == '1') {
                     $osC_Session->recreate();
                 }
                 $osC_Customer->setCustomerData(osC_Account::getID($_POST['email_address']));
                 $Qupdate = $osC_Database->query('update :table_customers set date_last_logon = :date_last_logon, number_of_logons = number_of_logons+1 where customers_id = :customers_id');
                 $Qupdate->bindTable(':table_customers', TABLE_CUSTOMERS);
                 $Qupdate->bindRaw(':date_last_logon', 'now()');
                 $Qupdate->bindInt(':customers_id', $osC_Customer->getID());
                 $Qupdate->execute();
                 $osC_ShoppingCart->synchronizeWithDatabase();
                 $toC_Wishlist->synchronizeWithDatabase();
                 $osC_NavigationHistory->removeCurrentPage();
                 if ($osC_NavigationHistory->hasSnapshot()) {
                     $osC_NavigationHistory->redirectToSnapshot();
                 } else {
                     osc_redirect(osc_href_link(FILENAME_DEFAULT, null, 'AUTO'));
                 }
             } else {
                 $messageStack->add('login', $osC_Language->get('error_login_status_disabled'));
             }
         } else {
             $messageStack->add('login', $osC_Language->get('error_login_no_match'));
         }
     } else {
         $messageStack->add('login', $osC_Language->get('error_login_no_match'));
     }
 }
 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'));
         }
     }
 }