1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-22 17:18:37 +00:00

get up to date for merge

This commit is contained in:
tcit 2014-09-28 17:31:02 +02:00
commit ffcd442989
11 changed files with 116 additions and 33 deletions

View file

@ -117,10 +117,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();