]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - settings/install2.php
Add Settings - RPC Servers (start of multi-server work).
[irc/unrealircd/unrealircd-webpanel.git] / settings / install2.php
index 361fe14ebfb4b3f6f44e5478ba9309ceaffc363e..3f9806b62a1f21c9d3d622fc1f5889044114b98a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-require_once "../common.php";
+require_once "../inc/common.php";
 
 /* Get the base url */
 $uri = $_SERVER['REQUEST_URI'];
@@ -125,12 +125,12 @@ $writable = (is_writable("../config/")) ? true: false;
        </div>
        <div class="form-group">
                <label for="rpc_username">Username</label>
-               <input name="rpc_user" type="text" class="revalidation-needed-rpc form-control" id="rpc_user" aria-describedby="username_help">
+               <input name="rpc_user" type="text" class="revalidation-needed-rpc form-control" id="rpc_user" aria-describedby="username_help" autocomplete="new-password">
                <small id="username_help" class="form-text text-muted">The name of your <code>rpc-user</code> block as defined in your <code>unrealircd.conf</code></small>
        </div>
        <div class="form-group">
                <label for="rpc_password">Password</label>
-               <input name="rpc_password" type="password" class="revalidation-needed-rpc form-control" id="rpc_password">
+               <input name="rpc_password" type="password" class="revalidation-needed-rpc form-control" id="rpc_password" autocomplete="new-password">
        </div>
        <div class="text-center">
                <button id="page2_next" type="submit" class="btn btn-primary ml-3">Submit</div>
@@ -181,7 +181,16 @@ $writable = (is_writable("../config/")) ? true: false;
        test_conn.addEventListener('click', e => {
                test_conn.classList.add('disabled');
                test_conn.innerHTML = "Checking...";
-               fetch(BASE_URL + 'api/installation2.php?method=rpc&host='+rpc_host.value+'&port='+rpc_port.value+'&user='+rpc_user.value+'&password='+rpc_pass.value+'&tls_verify='+rpc_tls.checked)
+               fetch(BASE_URL + 'api/installation2.php', {
+                     method:'POST',
+                     headers: {'Content-Type':'application/x-www-form-urlencoded'},
+                     body: 'method=rpc&'+
+                           'host='+encodeURIComponent(rpc_host.value)+
+                           '&port='+encodeURIComponent(rpc_port.value)+
+                           '&user='+encodeURIComponent(rpc_user.value)+
+                           '&password='+encodeURIComponent(rpc_pass.value)+
+                           '&tls_verify='+rpc_tls.checked
+                     })
                .then(response => response.json())
                .then(data => {
                        if (data.success)