summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-02-14 15:34:51 +0100
committerFlorian Pritz <bluewind@xinu.at>2013-02-14 15:34:51 +0100
commitea7467a584ad344e13f0cc595f58a1bb22e1649c (patch)
tree448698428db508b00532e2902203d07732b0549d /application
parentb43fab180d79feac25e25cba285730a48433564c (diff)
Move cli client login code to muser constructor
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/controllers/file.php21
-rw-r--r--application/models/muser.php21
2 files changed, 21 insertions, 21 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index e9637663b..429efbe6e 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -43,27 +43,6 @@ class File extends CI_Controller {
$this->var->view_dir = "file";
}
- if (is_cli_client()) {
- $username = $this->input->post("username");
- $password = $this->input->post("password");
-
- // prefer post parameters if either (username or password) is set
- if ($username === false && $password === false) {
- if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
- $username = $_SERVER['PHP_AUTH_USER'];
- $password = $_SERVER['PHP_AUTH_PW'];
- }
- }
-
- if ($username !== false && $password !== false) {
- if (!$this->muser->login($username, $password)) {
- // TODO: better message
- echo "login failed.\n";
- exit;
- }
- }
- }
-
$this->data['username'] = $this->muser->get_username();
$this->data['title'] = "FileBin";
}
diff --git a/application/models/muser.php b/application/models/muser.php
index e0994cfa6..29c5a453f 100644
--- a/application/models/muser.php
+++ b/application/models/muser.php
@@ -18,6 +18,27 @@ class Muser extends CI_Model {
$this->load->helper("filebin");
$this->load->driver("duser");
+
+ if (is_cli_client()) {
+ $username = $this->input->post("username");
+ $password = $this->input->post("password");
+
+ // prefer post parameters if either (username or password) is set
+ if ($username === false && $password === false) {
+ if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
+ $username = $_SERVER['PHP_AUTH_USER'];
+ $password = $_SERVER['PHP_AUTH_PW'];
+ }
+ }
+
+ if ($username !== false && $password !== false) {
+ if (!$this->login($username, $password)) {
+ // TODO: better message
+ echo "login failed.\n";
+ exit;
+ }
+ }
+ }
}
function has_session()