aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortcit <tcit@tcit.fr>2014-07-25 08:42:03 +0200
committertcit <tcit@tcit.fr>2014-07-25 08:42:03 +0200
commit046b9316244c7a3a19446b2425d2370a26246af0 (patch)
treef1e126a7590b32767ab22cb372ff474eab70836d
parent2b58426b2d4a7f1585d5d7667c0a4fbea4cd29dd (diff)
downloadwallabag-046b9316244c7a3a19446b2425d2370a26246af0.tar.gz
wallabag-046b9316244c7a3a19446b2425d2370a26246af0.tar.zst
wallabag-046b9316244c7a3a19446b2425d2370a26246af0.zip
added email field
-rwxr-xr-xinc/poche/Database.class.php4
-rwxr-xr-xinc/poche/Poche.class.php5
-rw-r--r--inc/poche/Routing.class.php2
-rwxr-xr-xinstall/index.php4
-rwxr-xr-xthemes/baggy/config.twig8
-rwxr-xr-xthemes/baggy/css/main.css2
6 files changed, 16 insertions, 9 deletions
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 {
113 $query = $this->executeQuery($sql, array()); 113 $query = $this->executeQuery($sql, array());
114 } 114 }
115 115
116 public function install($login, $password) 116 public function install($login, $password, $email = '')
117 { 117 {
118 $sql = 'INSERT INTO users ( username, password, name, email) VALUES (?, ?, ?, ?)'; 118 $sql = 'INSERT INTO users ( username, password, name, email) VALUES (?, ?, ?, ?)';
119 $params = array($login, $password, $login, ' '); 119 $params = array($login, $password, $login, $email);
120 $query = $this->executeQuery($sql, $params); 120 $query = $this->executeQuery($sql, $params);
121 121
122 $sequence = ''; 122 $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
74 /** 74 /**
75 * Creates a new user 75 * Creates a new user
76 */ 76 */
77 public function createNewUser($username, $password) 77 public function createNewUser($username, $password, $email = "")
78 { 78 {
79 if (!empty($username) && !empty($password)){ 79 if (!empty($username) && !empty($password)){
80 $newUsername = filter_var($username, FILTER_SANITIZE_STRING); 80 $newUsername = filter_var($username, FILTER_SANITIZE_STRING);
81 $email = filter_var($email, FILTER_SANITIZE_STRING);
81 if (!$this->store->userExists($newUsername)){ 82 if (!$this->store->userExists($newUsername)){
82 if ($this->store->install($newUsername, Tools::encodeString($password . $newUsername))) { 83 if ($this->store->install($newUsername, Tools::encodeString($password . $newUsername), $email)) {
83 Tools::logm('The new user ' . $newUsername . ' has been installed'); 84 Tools::logm('The new user ' . $newUsername . ' has been installed');
84 $this->messages->add('s', sprintf(_('The new user %s has been installed. Do you want to <a href="?logout">logout ?</a>'), $newUsername)); 85 $this->messages->add('s', sprintf(_('The new user %s has been installed. Do you want to <a href="?logout">logout ?</a>'), $newUsername));
85 Tools::redirect(); 86 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
107 // update password 107 // update password
108 $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']); 108 $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']);
109 } elseif (isset($_GET['newuser'])) { 109 } elseif (isset($_GET['newuser'])) {
110 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); 110 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']);
111 } elseif (isset($_GET['deluser'])) { 111 } elseif (isset($_GET['deluser'])) {
112 $this->wallabag->deleteUser($_POST['password4deletinguser']); 112 $this->wallabag->deleteUser($_POST['password4deletinguser']);
113 } elseif (isset($_GET['epub'])) { 113 } elseif (isset($_GET['epub'])) {
diff --git a/install/index.php b/install/index.php
index 1ae782a2..9ed62de1 100755
--- a/install/index.php
+++ b/install/index.php
@@ -292,9 +292,11 @@ php composer.phar install</code></pre></li>
292 <p> 292 <p>
293 <label for="password">Password</label> 293 <label for="password">Password</label>
294 <input type="password" required id="password" name="password" value="wallabag" /> 294 <input type="password" required id="password" name="password" value="wallabag" />
295 <label for="show">Show password:</label> <input style="margin-left:-80px;" name="show" id="show" type="checkbox" onchange="document.getElementById('password').type = this.checked ? 'text' : 'password'">
295 </p> 296 </p>
296 <p> 297 <p>
297 <label for="show">Show password:</label> <input name="show" id="show" type="checkbox" onchange="document.getElementById('password').type = this.checked ? 'text' : 'password'"> 298 <label for="email">Email (not required)</label>
299 <input type="email" id="email" name="email" />
298 </p> 300 </p>
299 </fieldset> 301 </fieldset>
300 302
diff --git a/themes/baggy/config.twig b/themes/baggy/config.twig
index 46735f07..ccdd2273 100755
--- a/themes/baggy/config.twig
+++ b/themes/baggy/config.twig
@@ -138,11 +138,15 @@
138 <fieldset class="w500p"> 138 <fieldset class="w500p">
139 <div class="row"> 139 <div class="row">
140 <label class="col w150p" for="newusername">{% trans 'Login for new user' %}</label> 140 <label class="col w150p" for="newusername">{% trans 'Login for new user' %}</label>
141 <input class="col" type="text" id="newusername" name="newusername" placeholder="{% trans 'Login' %}"> 141 <input class="col" type="text" id="newusername" name="newusername" placeholder="{% trans 'Login' %}" required>
142 </div> 142 </div>
143 <div class="row"> 143 <div class="row">
144 <label class="col w150p" for="password4newuser">{% trans "Password for new user" %}</label> 144 <label class="col w150p" for="password4newuser">{% trans "Password for new user" %}</label>
145 <input class="col" type="password" id="password4newuser" name="password4newuser" placeholder="{% trans "Password" %}"> 145 <input class="col" type="password" id="password4newuser" name="password4newuser" placeholder="{% trans "Password" %}" required>
146 </div>
147 <div class="row">
148 <label class="col w150p" for="newuseremail">{% trans 'Email for new user' %}</label>
149 <input class="col" type="email" id="newuseremail" name="newuseremail" placeholder="{% trans 'Email' %}">
146 </div> 150 </div>
147 <div class="row mts txtcenter"> 151 <div class="row mts txtcenter">
148 <button type="submit">{% trans "Send" %}</button> 152 <button type="submit">{% trans "Send" %}</button>
diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css
index 6d320cd2..ad68c7b5 100755
--- a/themes/baggy/css/main.css
+++ b/themes/baggy/css/main.css
@@ -89,7 +89,7 @@ form fieldset {
89 margin: 0; 89 margin: 0;
90} 90}
91 91
92form input[type="text"], select, form input[type="password"], form input[type="url"] { 92form input[type="text"], select, form input[type="password"], form input[type="url"], form input[type="email"] {
93 border: 1px solid #999; 93 border: 1px solid #999;
94 padding: 0.5em 1em; 94 padding: 0.5em 1em;
95 min-width: 12em; 95 min-width: 12em;