only allow actions (admin) when in right state; prepare decline reason

- fixes on path's and varnames
This commit is contained in:
2018-02-23 17:43:08 +01:00
parent e88eb13d91
commit e38d201ec1
6 changed files with 57 additions and 41 deletions

View File

@@ -58,12 +58,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
# $first="test"; $last="test2"; $user="test3"; $note="empty"; $email="mail+test1@matthias-kesler.de";
$sql = "SELECT COUNT(*) FROM registrations WHERE username = '" . $username . "' LIMIT 1;";
$sql = "SELECT COUNT(*) FROM registrations WHERE username = '" . $username . "' AND NOT state = "
. RegisterState::RegistrationDeclined . " LIMIT 1;";
$res = $db->query($sql);
if ($res->fetchColumn() > 0) {
throw new Exception($language["USERNAME_PENDING_REGISTRATION"]);
}
require_once("MatrixConnection.php");
require_once("../MatrixConnection.php");
$mxConn = new MatrixConnection($homeserver, $access_token);
if ($mxConn->hasUser($username)) {
throw new Exception($language["USERNAME_REGISTERED"]);