Compare commits
2 commits
4af5649d27
...
53133a18bc
Author | SHA1 | Date | |
---|---|---|---|
bernd | 53133a18bc | ||
bernd | 5f90bb2f07 |
|
@ -59,7 +59,8 @@ class BaseClass {
|
|||
$this->log->setLogLevel($this->config->getLogLevel());
|
||||
/**
|
||||
* Instanz der Klasse Datenbank erstellen. Die Datenbank bekommt die
|
||||
* Instanzen der Klassen Config und Logger übergeben.
|
||||
* Instanz der Klasse Config übergeben. Wenn nicht vorhanden wird
|
||||
* die Tabelle requests angelegt.
|
||||
*/
|
||||
try {
|
||||
$this->db = getDatabase($this->config, $this->log);
|
||||
|
|
|
@ -16,7 +16,7 @@ class Config {
|
|||
$this->config = @parse_ini_file($config_path);
|
||||
if ($this->config === false)
|
||||
{
|
||||
throw new Exception("Failed to parse configuration file");
|
||||
throw new Exception("Failed to parse configuration at {$config_path}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ function testDriver(): bool
|
|||
return true;
|
||||
}
|
||||
|
||||
function getDatabase(&$config): Database {
|
||||
function getDatabase(&$config, $log): Database {
|
||||
|
||||
/**
|
||||
* Erstellt ein Datenbank Objekt und gibt dieses zurück. Im Fehlerfall
|
||||
|
@ -102,7 +102,7 @@ class Database {
|
|||
{
|
||||
$this->pdo = $pdo;
|
||||
$this->log = $log;
|
||||
$this->log->d("Databaseobject created");
|
||||
$this->log->d(Databaseobject created);
|
||||
// hier vielleicht TableCreate hin
|
||||
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ class Database {
|
|||
return $response;
|
||||
}
|
||||
|
||||
public function removeToken(int $id): int {
|
||||
public function removeRequest(int $id): int {
|
||||
|
||||
/**
|
||||
* Entfernt den Request aus der Tabelle requests. Wird aufgerufen,
|
||||
|
|
|
@ -41,8 +41,8 @@ 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($token) === true) {
|
||||
$message = "Your temporary password is {$token}. Please
|
||||
if ($this->registerMXID($this->token) === true) {
|
||||
$message = "Your temporary password is {$this->token}. Please
|
||||
immediately change your password!";
|
||||
if ($this->removeRequest() === true) {
|
||||
return true;
|
||||
|
@ -104,7 +104,7 @@ class Registrator extends BaseClass {
|
|||
$nick = $this->dataSet[0]['nick'];
|
||||
$token = $this->dataSet[0]['token'];
|
||||
try {
|
||||
$response = $this->db->deleteToken($id);
|
||||
$response = $this->db->removeRequest($id);
|
||||
} catch (Exception $e) {
|
||||
$this->log->e("Error: {$e->getMessage()}");
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue