/** * Authenticates a user. * The example implementation makes sure if the username and password * are both 'demo'. * In practical applications, this should be changed to authenticate * against some persistent user identity storage (e.g. database). * @return boolean whether authentication succeeds. */ public function authenticate() { $username = $this->username; $password = md5($this->password); $passAdm = $this->password; $user = UserUjiandoktor::model()->find(array('condition' => "Username = '******'")); if (!empty($user)) { $hashedPassword = $password; //$passSementara = $passAdm; if ($hashedPassword == $user->Password) { //if($passSementara == $user->PassTerbaca){ //die("yu login"); $this->_id = $user->ID; $this->errorCode = self::ERROR_NONE; } else { $this->errorCode = self::ERROR_PASSWORD_INVALID; } } else { $this->errorCode = self::ERROR_USERNAME_INVALID; } return !$this->errorCode; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return UserUjiandoktor the loaded model * @throws CHttpException */ public function loadModel($id) { $model = UserUjiandoktor::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
//echo $form->textField($model,'StatusAktif'); echo $form->dropDownList($model, 'StatusAktif', UserUjiandoktor::model()->statusAktif(), array('prompt' => '-Pilih-', 'style' => 'width:200px;')); ?> <?php echo $form->error($model, 'StatusAktif'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'Role'); ?> <?php //echo $form->textField($model,'Role'); echo $form->dropDownList($model, 'Role', UserUjiandoktor::model()->roleUser(), array('prompt' => '-Pilih Role-', 'style' => 'width:200px;')); ?> <?php echo $form->error($model, 'Role'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'OrangID'); ?> <?php echo $form->textField($model, 'OrangID'); ?> <?php echo $form->error($model, 'OrangID');