with getenv ("username")
I can find out the current user.
How on the login tab to implement the button to find out if there is such a user in the database?
sort of
else if (getenv("username") == $user->id ) { $this->_id = $user->id; $this->username = $user->login; $this->errorCode = self::ERROR_NONE; } I can check in principle.
login.php
<h1>Вход</h1> <p></p> <div class="form"> <?php $form = $this->beginWidget('CActiveForm', array( 'id' => 'login-form', 'enableClientValidation' => true, 'clientOptions' => array( 'validateOnSubmit' => true, ), )); ?> <p class="note">Поля с <span class="required">*</span> обязательны.</p> <div class="row"> <?php echo CHtml::label('Имя', 'n'); ?> <?php echo $form->textField($model, 'username'); ?> <?php echo $form->error($model, 'username'); ?> </div> <div class="row"> <?php echo CHtml::label('Пароль', 'p'); ?> <?php echo $form->passwordField($model, 'password'); ?> <?php echo $form->error($model, 'password'); ?> <p class="hint"> Для получения данных для входа обратитесь к администратору </p> </div> <div class="row rememberMe"> <?php echo $form->checkBox($model, 'rememberMe'); ?> <?php echo CHtml::label('Запомнить', 'r'); ?> <?php echo $form->error($model, 'rememberMe'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton('Вход'); ?> </div> <?php $this->endWidget(); ?> <?php $form = $this->beginWidget('CActiveForm', array( 'id' => 'ldap_login', 'enableClientValidation' => true, 'clientOptions' => array( 'validateOnSubmit' => true, ), )); ?> <?php echo CHtml::submitButton('Вход под текущим пользователем'); ?> <?php $this->endWidget(); ?> </div><!-- form --> it is necessary that the second button in useridentity passes the check
$ldapuser = User::model()->find('LOWER(login)=?', array(strtolower(getenv("username")))); else if ($ldapuser) { $this->_id = $ldapuser->id; $this->username = $ldapuser->login; $this->errorCode = self::ERROR_NONE; }