From 046b9316244c7a3a19446b2425d2370a26246af0 Mon Sep 17 00:00:00 2001 From: tcit Date: Fri, 25 Jul 2014 08:42:03 +0200 Subject: added email field --- inc/poche/Database.class.php | 4 ++-- inc/poche/Poche.class.php | 5 +++-- inc/poche/Routing.class.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 2c80b64b..8b52a9df 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -113,10 +113,10 @@ class Database { $query = $this->executeQuery($sql, array()); } - public function install($login, $password) + public function install($login, $password, $email = '') { $sql = 'INSERT INTO users ( username, password, name, email) VALUES (?, ?, ?, ?)'; - $params = array($login, $password, $login, ' '); + $params = array($login, $password, $login, $email); $query = $this->executeQuery($sql, $params); $sequence = ''; diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index a49413f2..c8a09f30 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -74,12 +74,13 @@ class Poche /** * Creates a new user */ - public function createNewUser($username, $password) + public function createNewUser($username, $password, $email = "") { if (!empty($username) && !empty($password)){ $newUsername = filter_var($username, FILTER_SANITIZE_STRING); + $email = filter_var($email, FILTER_SANITIZE_STRING); if (!$this->store->userExists($newUsername)){ - if ($this->store->install($newUsername, Tools::encodeString($password . $newUsername))) { + if ($this->store->install($newUsername, Tools::encodeString($password . $newUsername), $email)) { Tools::logm('The new user ' . $newUsername . ' has been installed'); $this->messages->add('s', sprintf(_('The new user %s has been installed. Do you want to logout ?'), $newUsername)); Tools::redirect(); diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index 2db57d12..6643397a 100644 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php @@ -107,7 +107,7 @@ class Routing // update password $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']); } elseif (isset($_GET['newuser'])) { - $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); + $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']); } elseif (isset($_GET['deluser'])) { $this->wallabag->deleteUser($_POST['password4deletinguser']); } elseif (isset($_GET['epub'])) { -- cgit v1.2.3