예제 #1
0
 /**
  * @param null $action
  *
  * @return string
  */
 protected function _getRedirectUrl($action = null)
 {
     if (!empty($action)) {
         // forward to that action page
         $_returnUrl = '/' . $this->id . '/' . $action;
     } else {
         // redirect to back from which you came
         if (null === ($_returnUrl = Pii::user()->getReturnUrl())) {
             // or take me home
             $_returnUrl = Pii::url($this->id . '/index');
         }
     }
     return $_returnUrl;
 }
예제 #2
0
 /**
  * Logs in the user using the given username and password in the model.
  *
  * @return boolean whether activate is successful
  */
 public function activate()
 {
     $_identity = $this->_identity;
     if (empty($_identity)) {
         $_identity = new DrupalUserIdentity($this->username, $this->password);
         if (!$_identity->authenticate()) {
             $_identity = null;
             return false;
         }
     }
     if (\CBaseUserIdentity::ERROR_NONE == $_identity->errorCode) {
         $this->_identity = $_identity;
         return Pii::user()->login($_identity);
     }
     return false;
 }