/**
  * Make a request to this method to get a captcha image.
  */
 public function index()
 {
     header('Content-type: image/jpeg');
     $builder = new Gregwar\Captcha\CaptchaBuilder();
     $builder->build()->output();
     $this->session->set_userdata('captcha_phrase', $builder->getPhrase());
 }
 /**
  * get captcha image for registration form
  *
  * @return Gregwar\Captcha\CaptchaBuilder
  * @see views/login/index.php
  */
 public function getCaptcha()
 {
     //create a captcha with the Captcha library
     $captcha = new Gregwar\Captcha\CaptchaBuilder();
     $captcha->build();
     //save the captcha characters in session
     Session::set('captcha', $captcha->getPhrase());
     return $captcha;
 }
Exemple #3
0
 /**
  * Проверочный код
  */
 public function captcha()
 {
     header('Content-type: image/jpeg');
     $phrase = new Gregwar\Captcha\PhraseBuilder();
     $phrase = $phrase->build(5, '0123456789');
     $builder = new Gregwar\Captcha\CaptchaBuilder($phrase);
     $builder->setBackgroundColor(mt_rand(220, 255), mt_rand(220, 255), mt_rand(220, 255));
     $builder->setDistortion(false)->build()->output();
     $_SESSION['captcha'] = $builder->getPhrase();
 }
Exemple #4
0
 /**
  * 验证码的action 通用化
  */
 public function validimgAction()
 {
     //php composer.phar require "gregwar/captcha"
     $builder = new \Gregwar\Captcha\CaptchaBuilder();
     $builder->build(90, 26);
     header('Content-type: image/jpeg');
     $this->ini->viewRenderType('echo');
     $builder->output();
     \Sooh\Base\Session\Data::getInstance()->set('validImg', $builder->getPhrase());
 }
Exemple #5
0
 /**
  * Generates the captcha, "returns" a real image, this is why there is header('Content-type: image/jpeg')
  * Note: This is a very special method, as this is echoes out binary data.
  */
 public static function generateAndShowCaptcha()
 {
     // create a captcha with the CaptchaBuilder lib (loaded via Composer)
     $captcha = new Gregwar\Captcha\CaptchaBuilder();
     $captcha->build(Config::get('CAPTCHA_WIDTH'), Config::get('CAPTCHA_HEIGHT'));
     // write the captcha character into session
     Session::set('captcha', $captcha->getPhrase());
     // render an image showing the characters (=the captcha)
     header('Content-type: image/jpeg');
     $captcha->output();
 }
Exemple #6
0
 public function index()
 {
     $builder = new Gregwar\Captcha\CaptchaBuilder();
     $builder->setDistortion(false);
     $builder->build();
     $this->session->set_userdata('captcha', $builder->getPhrase());
     $registrant = [];
     if (empty($this->session->flashdata('data')) === false) {
         $registrant = $this->session->flashdata('data');
     }
     $this->load->view('login/index', ['builder' => $builder, 'registrant' => $registrant]);
 }
Exemple #7
0
    global $app;
    $roles = $app->session->rolesAllowedTo($action);
    if ($checkMod && count($roles) == 1 && $roles[0] == 'mod') {
        return $checkAdminAuth('admConteni');
    } else {
        return checkRole($roles);
    }
}
*/
// Prepare dispatcher
$app->get('/captcha', function () use($app) {
    $builder = new Gregwar\Captcha\CaptchaBuilder();
    $builder->build();
    $app->response->headers->set('Content-Type', 'image/jpeg');
    $app->response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate');
    $app->flash('captcha', $builder->getPhrase());
    $builder->output();
})->name('shwCaptcha');
//$app->get('/userlog', 'UserlogCtrl:listar')->name('shwListaUserlog');
$app->get('/', 'PortalCtrl:verIndex')->name('shwIndex');
$app->get('/portal', 'PortalCtrl:verPortal')->name('shwPortal');
$app->get('/tos', 'PortalCtrl:verTos')->name('shwTos');
$app->get('/login', $checkNoSession, 'PortalCtrl:verLogin')->name('shwLogin');
$app->post('/login', $checkNoSession, 'PortalCtrl:login')->name('runLogin');
$app->post('/logout', 'PortalCtrl:logout')->name('runLogout');
$app->get('/registro', $checkNoSession, 'PortalCtrl:verRegistrar')->name('shwCrearUsuario');
$app->post('/registro', $checkNoSession, 'PortalCtrl:registrar')->name('runCrearUsuario');
$app->get('/validar/:idUsu/:token', 'PortalCtrl:verificarEmail')->name('runValidUsuario');
$app->get('/recuperar-clave', $checkNoSession, 'PortalCtrl:verRecuperarClave')->name('shwRecuperarClave');
$app->post('/recuperar-clave', $checkNoSession, 'PortalCtrl:recuperarClave')->name('runRecuperarClave');
$app->get('/reiniciar-clave/:idUsu/:token', $checkNoSession, 'PortalCtrl:verReiniciarClave')->name('shwReiniciarClave');
 public function captcha()
 {
     $builder = new \Gregwar\Captcha\CaptchaBuilder();
     $builder->build($width = 100, $height = 34);
     Session::put('phrase', $builder->getPhrase());
     $builder->output();
     return \Response::png();
 }