mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
added email field
This commit is contained in:
parent
2b58426b2d
commit
046b931624
6 changed files with 16 additions and 9 deletions
|
@ -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 = '';
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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'])) {
|
||||
|
|
|
@ -292,9 +292,11 @@ php composer.phar install</code></pre></li>
|
|||
<p>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" required id="password" name="password" value="wallabag" />
|
||||
<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'">
|
||||
</p>
|
||||
<p>
|
||||
<label for="show">Show password:</label> <input name="show" id="show" type="checkbox" onchange="document.getElementById('password').type = this.checked ? 'text' : 'password'">
|
||||
<label for="email">Email (not required)</label>
|
||||
<input type="email" id="email" name="email" />
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -138,11 +138,15 @@
|
|||
<fieldset class="w500p">
|
||||
<div class="row">
|
||||
<label class="col w150p" for="newusername">{% trans 'Login for new user' %}</label>
|
||||
<input class="col" type="text" id="newusername" name="newusername" placeholder="{% trans 'Login' %}">
|
||||
<input class="col" type="text" id="newusername" name="newusername" placeholder="{% trans 'Login' %}" required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col w150p" for="password4newuser">{% trans "Password for new user" %}</label>
|
||||
<input class="col" type="password" id="password4newuser" name="password4newuser" placeholder="{% trans "Password" %}">
|
||||
<input class="col" type="password" id="password4newuser" name="password4newuser" placeholder="{% trans "Password" %}" required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col w150p" for="newuseremail">{% trans 'Email for new user' %}</label>
|
||||
<input class="col" type="email" id="newuseremail" name="newuseremail" placeholder="{% trans 'Email' %}">
|
||||
</div>
|
||||
<div class="row mts txtcenter">
|
||||
<button type="submit">{% trans "Send" %}</button>
|
||||
|
|
|
@ -89,7 +89,7 @@ form fieldset {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
form input[type="text"], select, form input[type="password"], form input[type="url"] {
|
||||
form input[type="text"], select, form input[type="password"], form input[type="url"], form input[type="email"] {
|
||||
border: 1px solid #999;
|
||||
padding: 0.5em 1em;
|
||||
min-width: 12em;
|
||||
|
|
Loading…
Reference in a new issue