public function register() { $this->app->bind(Captcha::class, function () { $captcha = new Captcha(); $captcha->setPublicKey(env('CAPTCHA_PUBLIC')); $captcha->setPrivateKey(env('CAPTCHA_PRIVATE')); return $captcha; }); }
public function postEmail($profile_slug, Captcha $captcha, Request $request) { $user = $this->getPublicUserByProfileSlug($profile_slug); if (!$user->allow_profile_contact) { abort(404); } $this->validate($request, ['email' => 'required|email', 'name' => '', 'message' => 'required']); $captchaResponse = $captcha->check(); if (!$captchaResponse->isValid()) { Log::error('Captcha error on public speaker profile page ' . $request->url() . '; reason: ' . $captchaResponse->getError()); exit('You have not passed the captcha. Please try again.'); } Mail::send('emails.public-profile-contact', ['email' => $request->get('email'), 'name' => $request->get('name'), 'userMessage' => $request->get('message')], function ($m) use($user) { $m->from('*****@*****.**', 'Symposium'); $m->to($user->email, $user->name)->subject('Contact from your Symposium public profile page'); }); Session::flash('success-message', 'Message sent!'); return redirect()->route('speakers-public.show', ['profile_slug' => $user->profile_slug]); }
/** * Validate if the text type by the user matchs with the text generated by the * XmlInputImageValidate is correct or not * * @param Context $context * @param string $text */ public static function validateText($context) { return Captcha::TextIsValid($context->get("imagevalidate")); }
echo $form->errorSummary($model, ['header' => '']); ?> <?php echo $form->field($model, 'email', ['options' => ['tag' => 'dl', 'class' => 'form'], 'template' => "<dt>{label}</dt>\n<dd>{input}</dd>"])->label('Электронная почта'); ?> <?php echo $form->field($model, 'password', ['options' => ['tag' => 'dl', 'class' => 'form'], 'template' => "<dt>{label}</dt>\n<dd>{input}</dd>"])->passwordInput()->label('Пароль'); ?> <?php echo $form->field($model, 'remember', ['options' => ['class' => 'form-checkbox']])->checkbox(['label' => 'Запомнить меня на этом компьютере?']); ?> <?php if ($model->isShow) { ?> <?php echo $form->field($model, 'verifyCode', ['options' => ['tag' => 'dl', 'class' => 'form'], 'template' => "<dt>{label}</dt>\n<dd>{input}</dd>"])->widget(Captcha::className())->label('Код безопасности'); ?> <?php } ?> <?php echo Html::submitButton('Войти в сообщество', ['class' => 'btn btn-primary']); ?> <?php ActiveForm::end(); ?> </div> <div class="authbox-footer"> <p>Нет учетной записи? <a href="<?php echo Url::toRoute('/user/identity/registration'); ?>
<?php use Captcha\Captcha; use Xmlnuke\Core\Engine\Context; ############################################# # To create a XMLNuke capable PHP5 page # require_once "xmlnuke.inc.php"; ############################################# $context = Context::getInstance(); $cq = $context->get("xmlnuke.CAPTCHACHALLENGE") != "easy"; $c = intval($context->get("xmlnuke.CAPTCHALETTERS")); $captcha = new Captcha($context, $cq, $c); $captcha->show();
/** * Retrieve captcha Template. * * @param \Captcha\Captcha $captcha Captcha instance. * * @return string */ public static function getTemplate(\Captcha\Captcha $captcha) { return $captcha->html(); }