Bugfix, removeToken() in removeRequest() umbenannt
This commit is contained in:
parent
5f62b03a4d
commit
4af5649d27
|
@ -18,6 +18,10 @@ class Registrator extends BaseClass {
|
||||||
* Konstruktor von BaseClass ein Konfigurations- und ein Datenbakobjekt
|
* Konstruktor von BaseClass ein Konfigurations- und ein Datenbakobjekt
|
||||||
* ($this->config, $this->db), die Funktion generateToken(), sowie die
|
* ($this->config, $this->db), die Funktion generateToken(), sowie die
|
||||||
* Variable $this->token.
|
* 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 = [];
|
private $dataSet = [];
|
||||||
|
@ -37,10 +41,10 @@ class Registrator extends BaseClass {
|
||||||
$this->log->d("Validation started for token: {$_GET['token']}");
|
$this->log->d("Validation started for token: {$_GET['token']}");
|
||||||
if ($this->checkToken() === true) {
|
if ($this->checkToken() === true) {
|
||||||
if ($this->generateToken(32) === true) {
|
if ($this->generateToken(32) === true) {
|
||||||
if ($this->registerMXID() === true) {
|
if ($this->registerMXID($token) === true) {
|
||||||
$message = "Your temporary password is {$tmp_passwd}. Please
|
$message = "Your temporary password is {$token}. Please
|
||||||
immediately change your password!";
|
immediately change your password!";
|
||||||
if ($this->removeToken() === true) {
|
if ($this->removeRequest() === true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +75,7 @@ class Registrator extends BaseClass {
|
||||||
} else if ($count > 1) {
|
} else if ($count > 1) {
|
||||||
$this->log->e("Error: More than one token found");
|
$this->log->e("Error: More than one token found");
|
||||||
} else {
|
} 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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -85,20 +89,20 @@ class Registrator extends BaseClass {
|
||||||
* Paket von matrix-synapse aufgerufen.
|
* 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);
|
// $response = system($cmd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function removeToken(): bool {
|
private function removeRequest(): bool {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Läßt den Request aus der tabelle requests entfernen.
|
* Läßt den Request aus der tabelle requests entfernen.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$id = $this->dataSet[0];
|
$id = $this->dataSet[0]['id'];
|
||||||
$nick = $this->dataSet[1];
|
$nick = $this->dataSet[0]['nick'];
|
||||||
$token = $this->dataSet[2];
|
$token = $this->dataSet[0]['token'];
|
||||||
try {
|
try {
|
||||||
$response = $this->db->deleteToken($id);
|
$response = $this->db->deleteToken($id);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
Loading…
Reference in a new issue