public function accountLogin($attrs) { $account = new Cart66Account(); if ($accountId = Cart66Common::isLoggedIn()) { $account->load($accountId); } $data = array('account' => $account); // Look for password reset task if (isset($_POST['cart66-task']) && $_POST['cart66-task'] == 'account-reset') { $data['resetResult'] = $account->passwordReset(); Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Attempted to reset password: "******"] Account Login: "******"] Redirecting after login to: {$url}"); Cart66Session::drop('Cart66AccessDeniedRedirect'); wp_redirect($url); exit; } else { $view .= "<p class='Cart66Error'>Login failed</p>"; } } return $view; }
} if ($create_account) { $account->save(); $accountId = $account->id; Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Just created account with id: {$accountId}"); $product = new Cart66Product(); $product->load($data['attrs']['product']); if ($product->id <= 0) { $product->loadByItemNumber($data['attrs']['product']); } if ($product->id > 0) { $account->attachMembershipProduct($product, $account->firstName, $account->lastName); $accountId = $account->id; Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Attached membership to account id: {$accountId}"); } if ($account->login($acctData['username'], $acctData['password'])) { Cart66Session::set('Cart66AccountId', $account->id); } if (isset($data['attrs']['url'])) { wp_redirect($data['attrs']['url']); exit; } } } } $cartImgPath = Cart66Setting::getValue('cart_images_url'); if ($cartImgPath) { if (strpos(strrev($cartImgPath), '/') !== 0) { $cartImgPath .= '/'; } $createAccountImgPath = $cartImgPath . 'create-account.png';