reformat and cleanup; Add auth error to response on internal login(debug)

This commit is contained in:
2018-03-08 11:46:33 +01:00
parent d5f2b05d4d
commit 6b98ac4ae7
3 changed files with 20 additions and 30 deletions

View File

@@ -127,9 +127,7 @@ class MatrixMessage
private $message;
function __construct() {
$this->message = array(
"msgtype" => "m.notice",
);
$this->message = ["msgtype" => "m.notice"];
}
function set_type($msgtype) {

View File

@@ -1,26 +1,26 @@
<?php
$config = [
"homeserver" => "example.com",
"access_token" => "To be used for sending the registration notification",
"homeserver" => "example.com",
"access_token" => "To be used for sending the registration notification",
// Which e-mail-adresse shall the bot use to send e-mails?
"register_email" => 'register_bot@example.com',
// Where should the bot post registration requests to?
"register_room" => '$registerRoomID:example.com',
// Which e-mail-adresse shall the bot use to send e-mails?
"register_email" => 'register_bot@example.com',
// Where should the bot post registration requests to?
"register_room" => '$registerRoomID:example.com',
// Where is the public part of the bot located? make sure you have a / at the end
"webroot" => "https://myregisterdomain.net/",
// Where is the public part of the bot located? make sure you have a / at the end
"webroot" => "https://myregisterdomain.net/",
// optional: Do you have a place where howTo's are located? If not leave this value out
"howToURL" => "https://my-url-for-storing-howTos.net",
// optional: Do you have a place where howTo's are located? If not leave this value out
"howToURL" => "https://my-url-for-storing-howTos.net",
// When you want to collect the password on registration set this to true
"getPasswordOnRegistration" => false,
// When you want to collect the password on registration set this to true
"getPasswordOnRegistration" => false,
// to define where the data should be stored:
"databaseURI" => "sqlite:" . dirname(__FILE__) . "/db_file.sqlite",
// credentials for sqlite not used
"databaseUser" => "dbUser123",
"databasePass" => "secretPassword",
// to define where the data should be stored:
"databaseURI" => "sqlite:" . dirname(__FILE__) . "/db_file.sqlite",
// credentials for sqlite not used
"databaseUser" => "dbUser123",
"databasePass" => "secretPassword",
]
?>

View File

@@ -15,14 +15,6 @@ abstract class LoginRequester {
$loginRequester = LoginRequester::UNDEFINED;
try {
$input = json_decode('
{
"user": {
"id": "@matrix.id.of.the.user:example.com",
"password": "passwordOfTheUser"
}
}
',true);
$inputJSON = file_get_contents('php://input');
$input = json_decode($inputJSON, TRUE);
$mxid = NULL;
@@ -101,7 +93,7 @@ try {
}
} catch (Exception $e) {
error_log("Auth failed with error: " . $e->getMessage());
//$response["auth"]["error"] = $e->getMessage();
$response["auth"]["error"] = $e->getMessage();
}
print (json_encode($response, JSON_PRETTY_PRINT) . "\n");
?>
?>