1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

added email field

This commit is contained in:
tcit 2014-07-25 08:42:03 +02:00
parent 2b58426b2d
commit 046b931624
6 changed files with 16 additions and 9 deletions

View file

@ -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 = '';

View file

@ -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 <a href="?logout">logout ?</a>'), $newUsername));
Tools::redirect();

View file

@ -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'])) {