Skip to content
Snippets Groups Projects
Commit c9808a23 authored by Mathias Myhrvold Olsen's avatar Mathias Myhrvold Olsen
Browse files

index.html now has a password field and the index.js file also sends the...

index.html now has a password field and the index.js file also sends the password as well as the username
parent 286edb7e
Branches
No related tags found
No related merge requests found
Pipeline #114926 passed
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
</div> </div>
<form class="main" id="loginForm" onsubmit="login(event)"> <form class="main" id="loginForm" onsubmit="login(event)">
<input class="loginInput" placeholder="Brukernavn..." id="username" required pattern="([\w]+)"> <input class="loginInput" placeholder="Brukernavn..." id="username" required pattern="([\w]+)">
<input class="loginInput" type="password" placeholder="Passord..." id="password" required pattern="([\w]+)">
<button class="loginBtn">Logg inn</button> <button class="loginBtn">Logg inn</button>
</form> </form>
</div> </div>
......
...@@ -15,7 +15,8 @@ inputfield.addEventListener("input",function () { ...@@ -15,7 +15,8 @@ inputfield.addEventListener("input",function () {
function login(event){ function login(event){
event.preventDefault(); event.preventDefault();
let user = { let user = {
"username": document.getElementById('username').value "username": document.getElementById('username').value,
"password": document.getElementById('password').value
}; };
fetch('../api/user', { fetch('../api/user', {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment