Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     /**
      * @var Module $m
      */
     $m = Yii::$app->getModule('user');
     Module::validateConfig($this->_module);
     $this->attributes += ['email' => ['type' => Form::INPUT_TEXT, 'hint' => Yii::t('user', 'Please fill out your email to receive a link to reset your password')]];
     $this->leftFooter = $m->button(Module::BTN_HOME, [], ['tabindex' => 1]) . $m->button(Module::BTN_NEW_USER, [], ['tabindex' => 2]);
     $this->rightFooter = $m->button(Module::BTN_RESET_FORM, [], ['tabindex' => 3]) . ' ' . $m->button(Module::BTN_SUBMIT_FORM, [], ['tabindex' => 0]);
     parent::init();
 }
Esempio n. 2
0
    /**
     * @inheritdoc
     */
    public function init()
    {
        parent::init();
        $m = $this->_module;
        if ($this->model->scenario !== Module::SCN_EXPIRY) {
            if ($this->model->scenario !== Module::SCN_REGISTER) {
                $this->mergeAttributes(['username' => ['type' => Form::INPUT_TEXT], 'password' => ['type' => Form::INPUT_PASSWORD], 'rememberMe' => ['type' => Form::INPUT_CHECKBOX]]);
            }
            $this->leftFooter = $m->button(Module::BTN_FORGOT_PASSWORD) . $m->button(Module::BTN_NEW_USER);
            $this->rightFooter = $m->button(Module::BTN_LOGIN);
            if ($this->hasSocialAuth && $m->socialSettings['widgetEnabled']) {
                $social = $m->getSocialWidget();
                if (!isset($this->template)) {
                    $this->template = <<<HTML
<div class="row">
    <div class="col-sm-8">
        <legend>{$this->title}</legend>
        {fields}
    </div>
    <div class="col-sm-4">
        <legend>{$this->authTitle}</legend>
        {$social}
    </div>
</div>
{footer}
HTML;
                } else {
                    $this->template = str_replace('{social}', $social, $this->template);
                }
            }
        } else {
            $password = ['type' => Form::INPUT_PASSWORD];
            if (in_array(Module::SCN_EXPIRY, $m->passwordSettings['strengthMeter'])) {
                $password = ['type' => Form::INPUT_WIDGET, 'widgetClass' => PasswordInput::classname(), 'options' => ['options' => ['placeholder' => Yii::t('user', 'Password'), 'autocomplete' => 'new-password']]];
            }
            $this->mergeAttributes(['username' => ['type' => Form::INPUT_HIDDEN], 'password' => ['type' => Form::INPUT_PASSWORD], 'password_new' => $password, 'password_confirm' => ['type' => Form::INPUT_PASSWORD]]);
            $this->leftFooter = Html::hiddenInput('unlock-account', '1', ['id' => 'unlock-account']);
            $this->rightFooter = $m->button(Module::BTN_SUBMIT_FORM);
        }
    }