|
|
|
@ -48,11 +48,6 @@ if (isset($_GET['secret']) && $_GET['secret'] === REGISTRATION_PASSWORD) {
|
|
|
|
|
];
|
|
|
|
|
$content['mac'] = hash_hmac('sha1', $content['nonce']."\0".$content['username']."\0".$content['password']."\0".'notadmin', REGISTRATION_SHARED_SECRET);
|
|
|
|
|
|
|
|
|
|
# debug
|
|
|
|
|
echo '<!--';
|
|
|
|
|
var_dump($content);
|
|
|
|
|
echo '-->';
|
|
|
|
|
|
|
|
|
|
$ch = curl_init();
|
|
|
|
|
curl_setopt($ch, CURLOPT_URL, SYNAPSE_URL.'/_synapse/admin/v1/register');
|
|
|
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
|
|
@ -63,13 +58,13 @@ if (isset($_GET['secret']) && $_GET['secret'] === REGISTRATION_PASSWORD) {
|
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
|
$response = curl_exec($ch);
|
|
|
|
|
if (curl_error($ch) || curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) {
|
|
|
|
|
$decoded_response = json_decode($response);
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
Registration for "<?php echo $username ?>" unsuccessful. Please try again later.
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
} else {
|
|
|
|
|
$decoded_response = json_decode($response);
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
Registration successful. To start using it please install a Matrix client like <a href="https://element.io/download">Element</a><br>
|
|
|
|
@ -85,7 +80,6 @@ Also consider using a password manager.<br>
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
echo var_dump($decoded_response);
|
|
|
|
|
|
|
|
|
|
# logout out of session that exists after registering
|
|
|
|
|
$ch = curl_init();
|
|
|
|
|