cleanup: remove dummy portal example

This commit is contained in:
Alexandre Aubin 2023-09-27 20:35:57 +02:00
parent a130dec731
commit a2dc0bfb08

View file

@ -1,59 +0,0 @@
<html>
<center id="loginform" style="padding-top: 10em">
<p>
<label for="username"><b>Username</b></label>
<input id="username" type="text" placeholder="Enter Username" name="username" required>
</p>
<p>
<label for="password"><b>Password</b></label>
<input id="password" type="password" placeholder="Enter Password" name="password" required>
</p>
<button id="login">Login</button>
</center>
<center id="userdata" style="color:green;">
</center>
<script>
document.getElementById('login').onclick = function() {
var username = document.getElementById('username').value;
var password = document.getElementById('password').value;
let formData = new FormData();
formData.append("credentials", username + ":" + password);
let xhr = new XMLHttpRequest();
xhr.open("POST", "/yunohost/portalapi/login")
xhr.setRequestHeader('X-Requested-With', ''); // CSRF protection
xhr.send(formData)
xhr.onload = function() {
if (xhr.status != 200) {
// handle error
alert( 'Error: ' + xhr.status);
return;
}
let xhr2 = new XMLHttpRequest();
xhr2.open("GET", "/yunohost/portalapi/me")
xhr2.setRequestHeader('X-Requested-With', ''); // CSRF protection
xhr2.send();
xhr2.onload = function() {
if (xhr2.status != 200) {
// handle error
alert( 'Error fetching /me: ' + xhr2.status);
return;
}
document.getElementById('userdata').innerHTML = xhr2.response;
};
}
}
</script>
</html>