summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/controllers/user.php12
-rw-r--r--application/models/muser.php1
2 files changed, 13 insertions, 0 deletions
diff --git a/application/controllers/user.php b/application/controllers/user.php
index f52e9c0b1..21b58cf93 100644
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -41,6 +41,18 @@ class User extends CI_Controller {
$this->load->view('footer', $this->data);
}
+ function test_login()
+ {
+ $username = $this->input->post('username');
+ $password = $this->input->post('password');
+
+ if ($this->muser->login($username, $password)) {
+ $this->output->set_status_header(204);
+ } else {
+ $this->output->set_status_header(401);
+ }
+ }
+
function login()
{
$this->muser->require_session();
diff --git a/application/models/muser.php b/application/models/muser.php
index 044e2b845..720b4ee7e 100644
--- a/application/models/muser.php
+++ b/application/models/muser.php
@@ -37,6 +37,7 @@ class Muser extends CI_Model {
if ($username !== false && $password !== false) {
if (!$this->login($username, $password)) {
// TODO: better message
+ $this->output->set_status_header(401);
echo "login failed.\n";
exit;
}