Ejemplo n.º 1
0
 /**
  * Authenticates a user.
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     Utils::setBusqueda(["user" => $this->username, "state" => 1], 'user, password, state, id_user,id_charge,date_reg');
     $modelUser = ModelUser::model()->find(utils::getBusqueda());
     if (!$modelUser) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif ($modelUser->user !== $this->username || !password_verify($this->password, $modelUser->password)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->_id = $modelUser->id_user;
         $modelPerson = ModelPerson::model()->find("id_user=:id_user", array("id_user" => $modelUser->id_user));
         $this->setState("id_charge", $modelUser->id_charge);
         $this->setState("id_user", $modelUser->id_user);
         $this->setState("username", $modelUser->user);
         $this->setState("datereg", $modelUser->date_reg);
         $this->setState("id_person", $modelPerson->id_person);
         $this->setState("name", $modelPerson->name_person);
         $this->errorCode = self::ERROR_NONE;
     }
     return !$this->errorCode;
 }
Ejemplo n.º 2
0
 /**
  * Verifica la mail de la bd
  */
 public function actionVerifyMail()
 {
     $user_mail = Yii::app()->getRequest()->getPost('mail');
     $model_mail = ModelPerson::model()->findByAttributes(array('email' => $user_mail));
     if (count($model_mail)) {
         $retorno['state'] = true;
     } else {
         $retorno['state'] = false;
     }
     echo json_encode($retorno, JSON_PRETTY_PRINT);
 }
Ejemplo n.º 3
0
            <div class="col-sm-3 col-lg-3">
                <div class="dash-unit">
                    <dtitle>User Profile</dtitle>
                    <hr>
                    <div class="thumbnail">
                        <img src="<?php 
    echo UserIdentity::getPic();
    ?>
" alt="Profile Pic" class="img-circle">
                    </div>
                    <h1><?php 
    echo Utils::limitcharacters(Yii::app()->user->name, 15);
    ?>
</h1>
                    <h3><?php 
    echo ModelPerson::model()->findByPK(Yii::app()->user->id_person)->email;
    ?>
</h3>
                    <br>
                    <div class="info-user">
                        <a href="<?php 
    echo Yii::app()->createUrl('user/account');
    ?>
"><span aria-hidden="true" class="li_user fs1"></span></a>
                        <a href="#ChangePass" data-toggle="modal"><span aria-hidden="true" class="li_key fs1"></span></a>
                        <?php 
    $controller = new CController('user');
    $controller->renderPartial('application.views.user._pass');
    ?>
                    </div>
                </div>