reformat and cleanup; Add auth error to response on internal login(debug)
This commit is contained in:
@@ -127,9 +127,7 @@ class MatrixMessage
|
|||||||
private $message;
|
private $message;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->message = array(
|
$this->message = ["msgtype" => "m.notice"];
|
||||||
"msgtype" => "m.notice",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_type($msgtype) {
|
function set_type($msgtype) {
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
$config = [
|
$config = [
|
||||||
"homeserver" => "example.com",
|
"homeserver" => "example.com",
|
||||||
"access_token" => "To be used for sending the registration notification",
|
"access_token" => "To be used for sending the registration notification",
|
||||||
|
|
||||||
// Which e-mail-adresse shall the bot use to send e-mails?
|
// Which e-mail-adresse shall the bot use to send e-mails?
|
||||||
"register_email" => 'register_bot@example.com',
|
"register_email" => 'register_bot@example.com',
|
||||||
// Where should the bot post registration requests to?
|
// Where should the bot post registration requests to?
|
||||||
"register_room" => '$registerRoomID:example.com',
|
"register_room" => '$registerRoomID:example.com',
|
||||||
|
|
||||||
// Where is the public part of the bot located? make sure you have a / at the end
|
// Where is the public part of the bot located? make sure you have a / at the end
|
||||||
"webroot" => "https://myregisterdomain.net/",
|
"webroot" => "https://myregisterdomain.net/",
|
||||||
|
|
||||||
// optional: Do you have a place where howTo's are located? If not leave this value out
|
// 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",
|
"howToURL" => "https://my-url-for-storing-howTos.net",
|
||||||
|
|
||||||
// When you want to collect the password on registration set this to true
|
// When you want to collect the password on registration set this to true
|
||||||
"getPasswordOnRegistration" => false,
|
"getPasswordOnRegistration" => false,
|
||||||
|
|
||||||
// to define where the data should be stored:
|
// to define where the data should be stored:
|
||||||
"databaseURI" => "sqlite:" . dirname(__FILE__) . "/db_file.sqlite",
|
"databaseURI" => "sqlite:" . dirname(__FILE__) . "/db_file.sqlite",
|
||||||
// credentials for sqlite not used
|
// credentials for sqlite not used
|
||||||
"databaseUser" => "dbUser123",
|
"databaseUser" => "dbUser123",
|
||||||
"databasePass" => "secretPassword",
|
"databasePass" => "secretPassword",
|
||||||
]
|
]
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -15,14 +15,6 @@ abstract class LoginRequester {
|
|||||||
$loginRequester = LoginRequester::UNDEFINED;
|
$loginRequester = LoginRequester::UNDEFINED;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$input = json_decode('
|
|
||||||
{
|
|
||||||
"user": {
|
|
||||||
"id": "@matrix.id.of.the.user:example.com",
|
|
||||||
"password": "passwordOfTheUser"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
',true);
|
|
||||||
$inputJSON = file_get_contents('php://input');
|
$inputJSON = file_get_contents('php://input');
|
||||||
$input = json_decode($inputJSON, TRUE);
|
$input = json_decode($inputJSON, TRUE);
|
||||||
$mxid = NULL;
|
$mxid = NULL;
|
||||||
@@ -101,7 +93,7 @@ try {
|
|||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
error_log("Auth failed with error: " . $e->getMessage());
|
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");
|
print (json_encode($response, JSON_PRETTY_PRINT) . "\n");
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user