Exemplo n.º 1
0
 /**
  * Reset the password
  */
 public function forgotpasswordAction()
 {
     $email = $this->getRequest()->getParam('email');
     $params = $this->getRequest()->getParams();
     if (!empty($email) && !empty($params)) {
         $collection = App_Main::getResourceModel('admin/user_collection');
         $collection->addFieldToFilter('email', $email);
         $collection->load(false);
         if ($collection->getSize() > 0) {
             foreach ($collection as $item) {
                 $user = App_Main::getModel('admin/user')->load($item->getId());
                 if ($user->getId()) {
                     $pass = substr(md5(uniqid(rand(), true)), 0, 7);
                     $user->setPassword($pass);
                     $user->save();
                     $user->setPlainPassword($pass);
                     $user->sendNewPasswordEmail();
                     App_Main::getSingleton('core/session')->addSuccess('A new password was sent to your email address. Please check your email and click Back to Login.');
                     $email = '';
                 }
                 break;
             }
         } else {
             App_Main::getSingleton('core/session')->addError('Can\'t find email address.');
         }
     } elseif (!empty($params)) {
         App_Main::getSingleton('core/session')->addError('Email address is empty.');
     }
     $data = array('email' => $email);
     $this->_outTemplate('forgotpassword', $data);
 }
Exemplo n.º 2
0
 public function getCollection()
 {
     return App_Main::getResourceModel('admin/user_collection', $this->getResource());
 }
Exemplo n.º 3
0
 /**
  * Get the eav attributes for the entity object model
  * 
  * @return array attributes 
  */
 public function getEavAttributes()
 {
     if (!$this->getEntityTypeId()) {
         return false;
     }
     return App_Main::getResourceModel('core/eav')->getEavAttributes($this->getEntityTypeId());
 }