/** * @inheritdoc */ public function init() { /** * @var Module $m */ $m = Yii::$app->getModule('user'); if (!$m->getRegistrationSetting('randomUsernames', $this->userType)) { $this->attributes['username'] = ['type' => Form::INPUT_TEXT, 'options' => ['autocomplete' => 'new-username']]; } if (!$m->getRegistrationSetting('randomPasswords', $this->userType)) { $password = ['type' => Form::INPUT_PASSWORD]; if (in_array(Module::SCN_REGISTER, $m->passwordSettings['strengthMeter'])) { $password = ['type' => Form::INPUT_WIDGET, 'widgetClass' => PasswordInput::classname(), 'options' => ['options' => ['placeholder' => Yii::t('user', 'Password'), 'autocomplete' => 'off']]]; } $this->attributes['password'] = $password; } $this->attributes['email'] = ['type' => Form::INPUT_TEXT]; $captcha = ArrayHelper::getValue($m->registrationSettings, 'captcha', false); if ($captcha !== false && is_array($captcha)) { $this->attributes['captcha'] = ['type' => Form::INPUT_WIDGET, 'widgetClass' => Captcha::classname(), 'options' => $captcha['widget']]; } parent::init(); unset($this->attributes['rememberMe']); $this->leftFooter = $m->button(Module::BTN_HOME) . $m->button(Module::BTN_ALREADY_REGISTERED); $this->rightFooter = $m->button(Module::BTN_RESET_FORM) . ' ' . $m->button(Module::BTN_REGISTER); }
<?php /** * @copyright Copyright © Kartik Visweswaran, communityii, 2014 - 2015 * @package communityii/yii2-user * @version 1.0.0 * @see https://github.com/communityii/yii2-user */ use comyii\user\widgets\LoginForm; use comyii\user\widgets\Logo; /** * @var yii\web\View $this * @var LoginForm $model * @var string $loginTitle * @var string $authTitle * @var bool $hasSocialAuth */ ?> <div class="text-center"> <?php echo Logo::widget(); ?> </div> <div class="y2u-box"> <?php echo LoginForm::widget(['model' => $model, 'title' => $loginTitle, 'hasSocialAuth' => $hasSocialAuth, 'authTitle' => $authTitle]); ?> </div>