Skip to content

Commit 75236ad

Browse files
committed
Add some JS + AJAX to the provision page
1 parent e8ae119 commit 75236ad

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

assets/default.html

+29-5
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@
6464
box-shadow: 0 0px #005c5f;
6565
}
6666
</style>
67+
<script type='text/javascript'>
68+
function submit() {
69+
var ssid = document.getElementById('ssid').value;
70+
var password = document.getElementById('password').value;
71+
72+
if (ssid.length === 0) {
73+
alert('Please enter an SSID');
74+
return;
75+
}
76+
77+
var body = 'login=' + escape(ssid) + '&password=' + escape(password) + '&device-name=&connect=Connect';
78+
79+
var xhr = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
80+
81+
xhr.onreadystatechange = function() {
82+
if (this.readyState === 4) {
83+
window.close();
84+
}
85+
};
86+
87+
xhr.open('POST', '/', true);
88+
xhr.send(body);
89+
}
90+
</script>
6791
</head>
6892
<body>
6993
<div id='pagelogo'>
@@ -111,14 +135,14 @@
111135
</div>
112136
<div id="log-in-form-container">
113137
<div id='text'>
114-
<form id="form-holder" method="post" action="">
138+
<div>
115139
SSID:<br>
116-
<input type="text" name="login" value="" maxlength="32"><br>
140+
<input id="ssid" type="text" name="login" value="" maxlength="32"><br>
117141
PASSWORD:<br>
118-
<input type="password" name="password" value="" maxlength="64"><br>
142+
<input id="password" type="password" name="password" value="" maxlength="64"><br>
119143
<input type="hidden" name="device-name" value="" maxlength="48">
120-
<input type="submit" name="connect" value="Connect" class="button">
121-
</form>
144+
<input type="button" name="connect" value="Connect" class="button" onclick="submit();">
145+
</div>
122146
<br>
123147
<p>Please enter your WiFi network credentials.
124148
<br>Then the board will attempt to connect to your WiFi network.</br>

firmwares/19.4.4/m2m_aio_2b0.bin

0 Bytes
Binary file not shown.

firmwares/19.4.4/m2m_aio_3a0.bin

0 Bytes
Binary file not shown.

firmwares/19.5.2/m2m_aio_3a0.bin

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)