本文整理匯總了PHP中Varien_Event_Observer::getException方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Event_Observer::getException方法的具體用法?PHP Varien_Event_Observer::getException怎麽用?PHP Varien_Event_Observer::getException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getException方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: adminSessionUserLoginFailed
/**
* Wrapper for admin_session_user_login_failed event
*
* @param Varien_Event_Observer $observer
*/
public function adminSessionUserLoginFailed(Varien_Event_Observer $observer)
{
/** @var string $_userName */
$_userName = $observer->getUserName();
/** @var Mage_Core_Exception $_exception */
$_exception = $observer->getException();
/** @var string $_ipAddress */
$_ipAddress = $this->_getHelperInstance()->getIpAddress();
$this->_getModelLogInstance()->setIpAddress($_ipAddress)->loadInstance()->setUserName($_userName)->setException($_exception)->updateInstance();
}
示例2: afterAdminLoginFailed
/**
* Redirect admin to authorize controller after login fail
*
* @param Varien_Event_Observer $observer
*/
public function afterAdminLoginFailed(Varien_Event_Observer $observer)
{
if (null !== $this->_getOauthToken()) {
/** @var $session Mage_Admin_Model_Session */
$session = Mage::getSingleton('admin/session');
$session->addError($observer->getException()->getMessage());
$userType = Mage_Oauth_Model_Token::USER_TYPE_ADMIN;
$url = Mage::helper('oauth')->getAuthorizeUrl($userType);
Mage::app()->getResponse()->setRedirect($url)->sendHeaders()->sendResponse();
exit;
}
}
示例3: adminSessionLoginFailed
/**
* Log failure of sign in
*
* @param Varien_Event_Observer $observer
*/
public function adminSessionLoginFailed($observer)
{
$eventModel = $this->_logAdminLogin($observer->getUserName());
if (class_exists('Enterprise_Pci_Model_Observer', false) && $eventModel) {
$exception = $observer->getException();
if ($exception->getCode() == Enterprise_Pci_Model_Observer::ADMIN_USER_LOCKED) {
$eventModel->setInfo(Mage::helper('enterprise_logging')->__('User is locked'))->save();
}
}
}