working on backend:

- started FileStore implementation
- implemented placing cookies

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-07-18 01:22:43 +02:00
parent 67606a80f4
commit c5352ac73b
18 changed files with 399 additions and 26 deletions

View File

@@ -28,7 +28,7 @@ public class StaticPages extends PathHandler {
System.out.printf("Loading %s for lagnuage %s…", path, lang);
var response = loadTemplate(lang, path).orElseThrow(() -> new FileNotFoundException());
ex.getResponseHeaders().add("Content-Type", response.contentType);
ex.getResponseHeaders().add(CONTENT_TYPE, response.contentType);
ex.sendResponseHeaders(200, response.content.length);
OutputStream os = ex.getResponseBody();
os.write(response.content);

View File

@@ -33,11 +33,11 @@ function tryLogin(){
document.getElementById("error").innerHTML = "";
var data = Object.fromEntries(new FormData(document.getElementById('login')));
fetch(api+"/login",{
method: 'POST',
headers: {
'login-username': data.user,
'login-password': data.pass, // TODO: send via body?
Accept: 'application/json',
'Content-Type': 'application/json'
}
},
body: JSON.stringify(data)
}).then(handleLogin);
}

View File

@@ -11,11 +11,11 @@
<legend>User credentials</legend>
<label>
Username
<input type="text" name="user" />
<input type="text" name="username" />
</label>
<label>
Password
<input type="password" name="pass" />
<input type="password" name="password" />
</label>
<button type="button" onClick="tryLogin()">Login</button>
</fieldset>