summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-08-01 12:14:22 -0400
committerFrederic Guillot <fred@kanboard.net>2015-08-01 12:14:22 -0400
commitdb88a00d48d1dce48b8700e460c06ff7fb344f0a (patch)
treecdb089f5aadcbd22aa63612d4d50bbe63fcbe112 /app/Controller
parentdb69d5c429cf747e72c4ded26f3821e7f688bc13 (diff)
Add bruteforce protection
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Auth.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/Controller/Auth.php b/app/Controller/Auth.php
index e8889b7f..bb1154e4 100644
--- a/app/Controller/Auth.php
+++ b/app/Controller/Auth.php
@@ -2,6 +2,8 @@
namespace Controller;
+use Gregwar\Captcha\CaptchaBuilder;
+
/**
* Authentication controller
*
@@ -22,6 +24,7 @@ class Auth extends Base
}
$this->response->html($this->template->layout('auth/index', array(
+ 'captcha' => isset($values['username']) && $this->authentication->hasCaptcha($values['username']),
'errors' => $errors,
'values' => $values,
'no_layout' => true,
@@ -64,4 +67,19 @@ class Auth extends Base
$this->session->close();
$this->response->redirect($this->helper->url->to('auth', 'login'));
}
+
+ /**
+ * Display captcha image
+ *
+ * @access public
+ */
+ public function captcha()
+ {
+ $this->response->contentType('image/jpeg');
+
+ $builder = new CaptchaBuilder;
+ $builder->build();
+ $this->session['captcha'] = $builder->getPhrase();
+ $builder->output();
+ }
}