Update server:

* Check that $db variable is OK before processing database requests
	* Don't close $db before calling lastErrorMsg()
	* Add support for user & url parameters from gPass popup
This commit is contained in:
Gregory Soutade
2020-02-26 16:00:24 +01:00
parent 6f1e2a814d
commit 9d528aeaa0
4 changed files with 38 additions and 34 deletions

View File

@@ -1,19 +1,19 @@
<?php
/*
Copyright (C) 2013-2017 Grégory Soutadé
This file is part of gPass.
gPass is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
gPass is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with gPass. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -50,7 +50,7 @@ else
if (isset($_POST['get_passwords']) && isset($_POST['user']))
return list_entries($user);
if (isset($_POST['add_entry']) && isset($_POST['user']) &&
if (isset($_POST['add_entry']) && isset($_POST['user']) &&
isset($_POST['login']) && isset($_POST['password']) &&
isset($_POST['shadow_login']) && isset($_POST['salt']) &&
isset($_POST['access_token']) )
@@ -61,7 +61,7 @@ else
$salt,
$access_token);
if (isset($_POST['delete_entry']) && isset($_POST['user']) &&
if (isset($_POST['delete_entry']) && isset($_POST['user']) &&
isset($_POST['login']) && isset($_POST['access_token']))
return delete_entry($user,
$login,
@@ -69,7 +69,7 @@ else
}
?>
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
@@ -158,8 +158,8 @@ if ($user != "")
{
echo "<b>Add a new password</b><br/>\n";
echo 'URL <input type="text" name="url"/>';
echo 'login <input type="text" name="login" />';
echo 'URL <input type="text" name="url" value="' . (filter_input(INPUT_GET, "url", FILTER_SANITIZE_SPECIAL_CHARS) ?: "") . '"/>';
echo 'login <input type="text" name="login" value="' . (filter_input(INPUT_GET, "user", FILTER_SANITIZE_SPECIAL_CHARS) ?: "") . '"/>';
echo 'password <input id="new_password" type="text" name="password"/>';
echo 'master key <input type="text" name="mkey" onkeypress="if (event.keyCode == 13) add_password();" onkeyup="chkPass(this.value);"/>';
echo '<input type="button" value="Generate password" onClick="generate_password();"/>';