本文整理汇总了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();
}
}
}