php yii-captcha-Captcha类(方法)实例源码

下面列出了php yii-captcha-Captcha 类(方法)源码代码实例,从而了解它的用法。

作者:kashiri    项目:kscm   
<?php 
$form = ActiveForm::begin(['id' => 'contact-form', 'action' => '/contact']);
?>
                <?php 
echo $form->field($model, 'email')->textInput(['placeholder' => 'email'])->label(false);
?>
                <div class="clear" style="height:20px"></div>
                <?php 
echo $form->field($model, 'subject')->textInput(['placeholder' => 'тема'])->label(false);
?>
                <div class="clear" style="height:20px"></div>
                <?php 
echo $form->field($model, 'body')->textArea(['rows' => 6])->label(false);
?>
                <div class="clear" style="height:20px"></div>
                <?php 
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>', 'options' => ['placeholder' => 'введите код']])->label(false);
?>
                <div class="clear" style="height:20px"></div>
                <div class="form-group">
                    <?php 
echo Html::submitButton('Отправить', ['class' => 'btn btn-primary', 'name' => 'contact-button']);
?>
                </div>
                <div class="clear" style="height:16px"></div>
                <span class="form_hint">Чтобы закрыть форму нажмите ESC</span>
            <?php 
ActiveForm::end();
?>

</div>

作者:jlorent    项目:yii2-enhanced-captch   
/**
  * @inheritdoc
  * 
  * Takes the decision of rendering the widget or not depending on the number 
  * of requests made from the client IP.
  */
 public function run()
 {
     $captchaControl = new CaptchaControl(['model' => $this->model]);
     if ($captchaControl->hasReachedRequestNumber()) {
         parent::run();
     }
 }

作者:communityi    项目:yii2-use   
/**
  * @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);
 }

作者:cmsgear    项目:widget-for   
public function renderForm()
 {
     if (isset($this->form) && $this->form->active) {
         $model = $this->model;
         $activeForm = $this->activeForm;
         $fieldsHtml = FormUtil::getFieldsHtml($activeForm, $this->model, ['label' => $this->showLabel]);
         echo $fieldsHtml;
         if ($this->form->captcha) {
             if ($this->showLabel) {
                 $captchaHtml = $activeForm->field($model, 'captcha')->widget(Captcha::classname(), ['options' => ['placeholder' => 'Captcha*']]);
             } else {
                 $captchaHtml = $activeForm->field($model, 'captcha')->label(false)->widget(Captcha::classname(), ['options' => ['placeholder' => 'Captcha*']]);
             }
             echo $captchaHtml;
         }
         if (!isset($this->formActions)) {
             echo "<div class='frm-actions'><input type='submit' value='Submit' /></div>";
         } else {
             echo $this->formActions;
         }
     } else {
         echo "<div class='warning'>Form submission is disabled by site admin.</div>";
     }
 }

作者:Crocodile2    项目:php-   
<div class="login text-center">
<div class="login-form col-lg-5">
<div class="panel panel-default text-left">
	<div class="panel-heading"><strong>登录</strong></div>
	<div class="panel-body">
	<?php 
$form = ActiveForm::begin(['id' => 'login', 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['labelOptions' => ['class' => 'col-lg-2 control-label'], 'template' => "{label}<div class='col-lg-8'>{input}\n{error}</div>"]]);
?>
	<?php 
echo $form->field($model, 'username');
?>
	<?php 
echo $form->field($model, 'password')->passwordInput();
?>
	<?php 
echo $form->field($model, 'captcha')->widget(Captcha::className(), ['imageOptions' => ['class' => 'captcha'], 'template' => "<div class='row'><div class='col-lg-4'>{image}</div><div class='col-lg-8'>{input}</div></div>"]);
?>
    <div class="form-group">
		<div class="col-lg-2"></div>
        <div class="col-lg-7">
		<?php 
echo Html::submitButton('登&nbsp;&nbsp;录', ['class' => 'btn btn-primary', 'name' => 'login-button']);
?>
		</div>
	</div>
	<?php 
ActiveForm::end();
?>
	</div>
</div>
</div>

作者:elevatesolution    项目:proverb   
<div id="slide-content2" class="row" style="margin: 0; padding: 0;">
                                        <div class="mail" style="">
                                            <?php 
echo $form->field($model, 'username', ['inputTemplate' => '{input}', 'inputOptions' => ['id' => 'input-username-check', 'style' => 'margin-bottom: -10px;', 'class' => 'form-control pva-border', 'placeholder' => 'Username']])->label(false);
?>
                                            <?php 
echo $form->field($model, 'email', ['inputTemplate' => '{input}', 'inputOptions' => ['id' => 'input-mail-check', 'style' => 'margin-bottom: -10px;', 'class' => 'form-control pva-border', 'placeholder' => 'Email']])->label(false);
?>
     
                                            <?php 
echo $form->field($model, 'password', ['inputTemplate' => '{input}', 'inputOptions' => ['id' => 'input-password-check', 'style' => 'margin-bottom: -10px;', 'class' => 'form-control pva-border', 'placeholder' => 'Password']])->passwordInput()->label(false);
?>
                                        </div>
                                        <div class="vfy" style="">
                                            <?php 
echo $form->field($model, 'verifyCode')->label(false)->widget(Captcha::className(), ['template' => '<div class="display: inline;"><label class="pull-left" style="color: white;">Captcha Code: </label><div class="text-right">{image}</div><div style="margin-top: 25px; margin-bottom: 25px; color: white;">* * Click image to generate new captcha code</div></div><p></p>{input}']);
?>
                                        </div>
                                    </div>
                                </div>                                
                            </div>
                            <div class="slide-btn">
                                <button type="button" id="btn-info-check" class="btn btn-primary btn-block pva-border" style="height: 46px; background: #337AB7; border: 0;" data-toggle="modal" data-target="#verify">NEXT</button>
                            </div>
                        </div>
                        <p id="msg-info-check" style="color: white; font-size: 16px; margin-top: 20px;"></p>
                    </div>
                </div>
            </div>
        </div>
    </div>

作者:VasileGabrie    项目:humhu   
<div class="form-group">
                <?php 
//echo $form->labelEx($model, 'email');
?>
                <?php 
echo $form->textField($model, 'email', array('class' => 'form-control', 'id' => 'email_txt', 'placeholder' => Yii::t('UserModule.views_auth_recoverPassword', 'your email')));
?>
                <?php 
echo $form->error($model, 'email');
?>
            </div>

            <div class="form-group">
                <?php 
echo \yii\captcha\Captcha::widget(['model' => $model, 'attribute' => 'verifyCode', 'captchaAction' => '/user/auth/captcha', 'options' => array('class' => 'form-control', 'placeholder' => Yii::t('UserModule.views_auth_recoverPassword', 'enter security code above'))]);
?>
                <?php 
echo $form->error($model, 'verifyCode');
?>
            </div>

            <hr>
            <?php 
echo \humhub\widgets\AjaxButton::widget(['label' => Yii::t('UserModule.views_auth_recoverPassword', 'Reset password'), 'ajaxOptions' => ['type' => 'POST', 'beforeSend' => new yii\web\JsExpression('function(){ setModalLoader(); }'), 'success' => 'function(html){ $("#globalModal").html(html); }', 'url' => Url::to(['/user/password-recovery'])], 'htmlOptions' => ['class' => 'btn btn-primary', 'id' => 'recoverPasswordBtn']]);
echo \humhub\widgets\AjaxButton::widget(['label' => Yii::t('UserModule.views_auth_recoverPassword', 'Back'), 'ajaxOptions' => ['type' => 'POST', 'beforeSend' => new yii\web\JsExpression('function(){ setModalLoader(); }'), 'success' => 'function(html){ $("#globalModal").html(html); }', 'url' => Url::to(['/user/auth/login'])], 'htmlOptions' => ['class' => 'btn btn-primary', 'id' => 'backBtn']]);
?>
            <?php 
CActiveForm::end();
?>
        </div>

作者:kapilbhadk    项目:ConnectM   
<?php 
echo $form->field($model, 'username');
?>

                <?php 
if ($module->enableGeneratingPassword == false) {
    ?>
                    <?php 
    echo $form->field($model, 'password')->passwordInput();
    ?>
                <?php 
}
?>

                <?php 
echo $form->field($model, 'captcha')->widget(\yii\captcha\Captcha::className(), ['captchaAction' => ['/site/captcha']]);
?>

                <?php 
echo Html::submitButton(Yii::t('user', 'Sign up'), ['class' => 'btn btn-success btn-block']);
?>

                <?php 
ActiveForm::end();
?>
            </div>
        </div>
        <p class="text-center">
            <?php 
echo Html::a(Yii::t('user', 'Already registered? Sign in!'), ['/user/security/login']);
?>

作者:advance10    项目:yunjiany   
<div class="row">
                    <div class="col-lg-9">
                        <?php 
$form = ActiveForm::begin(['id' => 'form-signup', 'layout' => 'horizontal', 'fieldConfig' => ['template' => "{label}\n{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}", 'horizontalCssClasses' => ['label' => 'col-sm-4', 'offset' => 'col-sm-offset-4', 'wrapper' => 'col-sm-8', 'error' => '', 'hint' => '']]]);
?>
                            <?php 
echo $form->field($model, 'username')->textInput(['maxlength' => 255]);
?>
                            <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => 255]);
?>
                            <?php 
echo $form->field($model, 'password')->passwordInput(['maxlength' => 255]);
?>
                            <?php 
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['captchaAction' => '/account/captcha', 'imageOptions' => ['alt' => '点击换图', 'title' => '点击换图', 'style' => 'cursor:pointer'], 'template' => '<div class="row"><div class="col-lg-8">{input}</div><div class="col-lg-4">{image}</div></div>']);
?>
                            <div class="form-group">
                                <div class="col-sm-offset-4 col-sm-9">
                                <?php 
echo Html::submitButton('注册', ['class' => 'btn btn-primary', 'name' => 'signup-button']);
?>
                                </div>
                            </div>

                        <?php 
ActiveForm::end();
?>
                    </div>
                </div>
            </article>

作者:highestgoodlikewate    项目:ye   
$field = $form->field($model, "data[note]");
$field->template = "{input}";
echo $field->textArea(["class" => "form-control required", "placeholder" => Yii::t("app", "Notes for us / special request")]);
$model->data = $data;
?>
	
						</div>
						
						<?php 
if ($model->captchaRequired) {
    ?>
						
						<div class="well">							
							<div class="row">									
						<?php 
    echo $form->field($model, "captcha")->widget(Captcha::classname(), ['captchaAction' => ['/yes/order/captcha'], 'imageOptions' => ['class' => 'col-sm-4 col-xs-6', 'style' => 'margin:20px -5px 20px -5px;max-height:80px;cursor:pointer;'], 'options' => ['class' => 'col-sm-8 col-xs-6']]);
    ?>
							
							</div>
						</div>
						
						<?php 
}
?>
												
						<hr>
						<a onclick="$('#ordertab a[href=\'#summary\']').tab('show')" class="btn btn-warning btn-tab pull-left" ><?php 
echo Yii::t("app", "Previous");
?>
</a>
						<div class="form-group">

作者:daixiancen    项目:xiaoego.co   
?>
            <div class="alert alert-warning" role="alert"><?php 
        echo $session->getFlash('resignup');
        ?>
</div>
            <?php 
    }
    ?>
            <?php 
    echo $form->field($model, 'mobile');
    ?>
            <?php 
    echo $form->field($model, 'password')->passwordInput();
    ?>
            <?php 
    echo $form->field($model, 'captcha')->widget(Captcha::className(), ['template' => "<div class=\"row\">\n<div class=\"col-xs-6\">\n{input}\n</div>\n<div class=\"col-xs-4\">\n{image}\n</div>\n</div>"])->hint('点击验证码换一个。');
    ?>
            <div class="form-group">
                <?php 
    echo Html::submitButton('下一步 <i class="fa fa-angle-double-right"></i>', ['class' => 'btn btn-primary btn-fill']);
    ?>
            </div>
            <div class="form-group text-right">
                <?php 
    echo Html::a('已有帐号?去登录<i class="fa fa-long-arrow-right"></i>', ['/site/login']);
    ?>
            </div>
        <?php 
    ActiveForm::end();
    ?>
        <?php

作者:kshukos    项目:readm   
?>

                    <?php 
    echo $form->field($model, 'name')->textInput(['size' => 60]);
    ?>
                    <?php 
    echo $form->field($model, 'email')->textInput(['size' => 60]);
    ?>
                    <?php 
    echo $form->field($model, 'subject')->textInput(['size' => 60]);
    ?>
                    <?php 
    echo $form->field($model, 'text')->textarea(['rows' => 10, 'cols' => 80]);
    ?>
                    <?php 
    echo $form->field($model, 'captcha')->widget(Captcha::className(), ['model' => $model, 'attribute' => 'captcha', 'captchaAction' => '/app/captcha', 'template' => '<div class="cols">{image}</div> <div class="cols">{input}</div>']);
    ?>

                    <div class="wrap-box-row-submit">
                        <div class="wrap-box-value">
                            <?php 
    echo Html::submitButton('Відправити', ['class' => 'buttonOrange', 'name' => 'contact-button']);
    ?>
                        </div>
                    </div>
                    <?php 
    ActiveForm::end();
    ?>


                <?php

作者:rockieli    项目:yii2-app-advanced-templat   
echo Html::activeInput("password", $model, "password", ['placeholder' => "請輸入密碼", "required" => true]);
?>
        <span>輸入6-12位元英數密碼(不分大小寫)</span>
    </div>
    <div class="psw">
        <?php 
echo Html::activeInput("password", $model, "chkpassword", ['placeholder' => "請確認密碼", "required" => true]);
?>
        <span>確認您的密碼</span>
    </div>


    <div class="reload">
        <div class="image">
            <?php 
echo $form->field($model, 'captcha')->widget(\yii\captcha\Captcha::className(), ['template' => '<div class="pic">{image}</div>', "imageOptions" => ["style" => "width:60px;height:40px;"]])->label(false)->error(false);
?>
        </div>
        <div class="code">
            <?php 
echo Html::activeInput("text", $model, "captcha", ['placeholder' => "請輸入圖形驗證碼", "required" => true, "style" => "padding-left: 70px; padding-right: 0px;"]);
?>
        </div>
        <span>請輸入圖形驗證碼</span>
    </div>
    <p>如果繼續,即表示同意接受會員條款</p>
    <button type="submit">註冊</button>
    <?php 
ActiveForm::end();
?>
</div>

作者:Makeyk    项目:galaxyss   
$form = ActiveForm::begin(['id' => 'contact-form']);
    ?>
                <?php 
    echo $form->field($model, 'name')->label('Ваше имя');
    ?>
                <?php 
    echo $form->field($model, 'email')->label('Email');
    ?>
                <?php 
    echo $form->field($model, 'subject')->label('Тема');
    ?>
                <?php 
    echo $form->field($model, 'body')->textArea(['rows' => 6])->label('Сообщение');
    ?>
                <?php 
    echo $form->field($model, 'verifyCode')->hint('Введите код указанный на картинке')->widget(Captcha::className(), ['template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>']);
    ?>
                <div class="form-group">
                    <?php 
    echo Html::submitButton('Отправить', ['class' => 'btn btn-primary', 'name' => 'contact-button']);
    ?>
                </div>
            <?php 
    ActiveForm::end();
    ?>
        </div>
    </div>

    <?php 
}
?>

作者:welcomedcoffe    项目:dcoffe   
<!--账号-->
        <?php 
echo $form->field($model, 'username', ['inputOptions' => ['placeholder' => '请输入用户名', 'class' => 'input-text size-L'], 'template' => '<div class="row cl"><label class="form-label col-3"><i class="Hui-iconfont">&#xe60d;</i></label><div class="formControls col-8">{input}{error}</div></div>'])->textInput();
?>
        
        <!--密码-->

        <?php 
echo $form->field($model, 'password', ['inputOptions' => ['placeholder' => '请输入密码', 'class' => 'input-text size-L'], 'template' => '<div class="row cl"><label class="form-label col-3"><i class="Hui-iconfont">&#xe60e;</i></label><div class="formControls col-8">{input}{error}</div></div>'])->passwordInput();
?>

        <!--验证码-->

        <?php 
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['template' => '<div class="row cl"><div class="formControls col-8 col-offset-3" id="verify-div">{image}<span id="imgcode">{input}</span></div></div>', 'imageOptions' => ['alt' => '验证码'], 'captchaAction' => 'login/captcha', 'options' => ['placeholder' => '请输入验证码', 'class' => 'input-text size-L', 'id' => 'verify']]);
?>
        
        <!--登陆-->      
        <div class="row">
            <div class="formControls col-8 col-offset-3">
                <?php 
echo Html::submitButton('登陆', ['class' => 'btn btn-success radius size-L']);
?>
                <?php 
echo Html::resetButton('重置', ['class' => 'btn btn-default radius size-L']);
?>
                    
            </div>
        </div>

作者:yangla    项目:yii2-aut   
echo $form->field($model, 'user_loginname');
    ?>
                    <?php 
    echo $form->field($model, 'user_password')->passwordInput();
    ?>
                    <?php 
    echo $form->field($model, 'verifyPassword')->passwordInput();
    ?>
                    <?php 
    echo $form->field($model, 'user_email');
    ?>
                    <?php 
    echo $form->field($model, 'verifyEmail');
    ?>
                    <?php 
    echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['captchaAction' => 'default/captcha', 'options' => ['class' => 'form-control']]);
    ?>
                    <?php 
    echo Html::submitButton('<i></i><span class="strong">' . \Yii::t('auth.user', 'Sign up') . '</span><span>成为宠嗨网会员</span>', ['class' => 'btn btn-icon-stacked btn-block btn-success glyphicons user_add']);
    ?>
                    <p><?php 
    echo Html::a(\Yii::t('auth.user', 'Already registered? Sign in!'), ['/auth/default/login']);
    ?>
</p>
                </div>
                <?php 
    ActiveForm::end();
    ?>
                <!-- // Form END -->
                    <?php 
}

作者:nordsoftwar    项目:yii2-accoun   
/**
  * Initializes the class map.
  */
 protected function initClassMap()
 {
     $this->classMap = ArrayHelper::merge([self::CLASS_ACCOUNT => Account::className(), self::CLASS_TOKEN => AccountToken::className(), self::CLASS_PROVIDER => AccountProvider::className(), self::CLASS_LOGIN_HISTORY => AccountLoginHistory::className(), self::CLASS_PASSWORD_HISTORY => AccountPasswordHistory::className(), self::CLASS_LOGIN_FORM => LoginForm::className(), self::CLASS_PASSWORD_FORM => PasswordForm::className(), self::CLASS_SIGNUP_FORM => SignupForm::className(), self::CLASS_CONNECT_FORM => ConnectForm::className(), self::CLASS_FORGOT_PASSWORD_FORM => ForgotPasswordForm::className(), self::CLASS_WEB_USER => User::className(), self::CLASS_CAPTCHA => Captcha::className(), self::CLASS_CAPTCHA_ACTION => CaptchaAction::className(), self::CLASS_PASSWORD_BEHAVIOR => PasswordAttributeBehavior::className(), self::CLASS_PASSWORD_VALIDATOR => PasswordStrengthValidator::className()], $this->classMap);
 }

作者:sdram5    项目:proyectofina   
</p>

        <div class="row">
            <div class="col-lg-5">

                <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>

                    <?= $form->field($model, 'name')->label("Nombre") ?>

                    <?= $form->field($model, 'email') ?>

                    <?= $form->field($model, 'subject')->label('Asunto') ?>

                    <?= $form->field($model, 'body')->textArea(['rows' => 6])->label("Cuerpo") ?>

                    <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
                        'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
                    ]) ?>

                    <div class="form-group">
                        <?= Html::submitButton('Enviar', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
                    </div>

                <?php ActiveForm::end(); ?>

            </div>
        </div>

    <?php endif; ?>
</div>
<br />

作者:cj    项目:QRCode-yii   
<div class="col-sm-7">
        <p><?php 
echo Module::t('site', 'CONTACTS_FORM_INFO');
?>
</p>
        <?php 
$form = ActiveForm::begin();
?>
        <?php 
echo $form->field($model, 'name');
?>
        <?php 
echo $form->field($model, 'email');
?>
        <?php 
echo $form->field($model, 'subject');
?>
        <?php 
echo $form->field($model, 'body')->textArea(['rows' => 6]);
?>
        <?php 
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['captchaAction' => '/site/default/captcha', 'options' => ['class' => 'form-control'], 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-9">{input}</div></div>']);
?>
        <?php 
echo Html::submitButton(Module::t('site', 'CONTACTS_SUBMIT_BTN'), ['class' => 'btn btn-primary btn-lg']);
?>
        <?php 
ActiveForm::end();
?>
    </div>
</div>

作者:lzpfm    项目:dotplant   
if ($group->hidden_group_title == 0) {
        ?>
            <h4><?php 
        echo $group->name;
        ?>
</h4>
        <?php 
    }
    ?>
        <?php 
    $properties = Property::getForGroupId($group->id);
    ?>
        <?php 
    foreach ($properties as $property) {
        ?>
            <?php 
        if ($property->captcha) {
            echo Captcha::widget(['model' => $model->abstractModel, 'attribute' => $property->key, 'captchaAction' => ['/default/captcha']]);
        } else {
            echo $property->handler($form, $model->abstractModel, [], 'frontend_edit_view');
        }
        ?>
        <?php 
    }
    ?>
    <?php 
}
?>
    <?php 
echo \kartik\helpers\Html::submitButton(Yii::t('app', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();


问题


面经


文章

微信
公众号

扫码关注公众号