Bugfix, removeToken() in removeRequest() umbenannt

This commit is contained in:
bernd 2021-03-01 18:45:53 +01:00
parent 5f62b03a4d
commit 4af5649d27

View file

@ -18,6 +18,10 @@ class Registrator extends BaseClass {
* Konstruktor von BaseClass ein Konfigurations- und ein Datenbakobjekt
* ($this->config, $this->db), die Funktion generateToken(), sowie die
* Variable $this->token.
*
* Achtung: Die Variable hält in diesem Skript nicht das Token der
* Validierung, sondern das temporäre Passwort! Das ursprüngliche Token
* bleibt in $_GET['token'].
*/
private $dataSet = [];
@ -37,10 +41,10 @@ class Registrator extends BaseClass {
$this->log->d("Validation started for token: {$_GET['token']}");
if ($this->checkToken() === true) {
if ($this->generateToken(32) === true) {
if ($this->registerMXID() === true) {
$message = "Your temporary password is {$tmp_passwd}. Please
if ($this->registerMXID($token) === true) {
$message = "Your temporary password is {$token}. Please
immediately change your password!";
if ($this->removeToken() === true) {
if ($this->removeRequest() === true) {
return true;
}
}
@ -71,7 +75,7 @@ class Registrator extends BaseClass {
} else if ($count > 1) {
$this->log->e("Error: More than one token found");
} else {
$this->log->d("Token found for nick: {$this->dataSet[1]}");
$this->log->d("Token found for nick: {$this->dataSet[0]['nick']}");
return true;
}
return false;
@ -85,20 +89,20 @@ class Registrator extends BaseClass {
* Paket von matrix-synapse aufgerufen.
*/
// $cmd = "register_new_matrix_user -u {$this->dataSet[1]} -p {$tmp_pass}";
// $cmd = "register_new_matrix_user -u {$this->dataSet[0]['nick']} -p {$tmp_pass}";
// $response = system($cmd);
return true;
}
private function removeToken(): bool {
private function removeRequest(): bool {
/**
* Läßt den Request aus der tabelle requests entfernen.
*/
$id = $this->dataSet[0];
$nick = $this->dataSet[1];
$token = $this->dataSet[2];
$id = $this->dataSet[0]['id'];
$nick = $this->dataSet[0]['nick'];
$token = $this->dataSet[0]['token'];
try {
$response = $this->db->deleteToken($id);
} catch (Exception $e) {