Skip to content
Snippets Groups Projects
Commit baf19de3 authored by Erlend Ryan's avatar Erlend Ryan
Browse files

userLogin

parent 6a56d9b5
No related branches found
No related tags found
No related merge requests found
Pipeline #72066 passed
......@@ -25,6 +25,11 @@ a:hover { color: #2C303C; }
align-self: center;
justify-self: center;
}
.login {
display:flex;
flex-direction: column;
justify-content: space-between;
}
.loginInput {
align-self: center;
......@@ -34,6 +39,7 @@ a:hover { color: #2C303C; }
padding: 2px;
margin: 2px;
box-sizing: border-box;
margin-bottom:10px;
}
.loginBtn {
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
......@@ -8,16 +9,24 @@
<link rel="stylesheet" href="css/app.css" />
<title>ChatPage</title>
</head>
<body>
<div class="container">
<div class="navbar">
<h1 class="header">Meldingsapplikasjon</h1>
</div>
<form class="main" id="loginForm" onsubmit="login(event)">
<form class="main login" id="loginForm" onsubmit="login(event)">
<input class="loginInput" placeholder="Brukernavn..." id="username" required pattern="([\w]+)">
<input class="loginInput" type="password" placeholder="Passord..." id="password" required pattern="[\s\S]*">
<button class="loginBtn">Logg inn</button>
</form>
</div>
<script type="text/javascript" src="./js/index.js"></script>
</body>
</html>>
</html>index.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -15,7 +15,8 @@ inputfield.addEventListener("input",function () {
function login(event) {
event.preventDefault();
let user = {
"username": document.getElementById('username').value
"username": document.getElementById('username').value,
"password": document.getElementById('password').value
};
fetch('../api/user', {
......@@ -43,4 +44,6 @@ function loadApplication(user){
sessionStorage.setItem("username", user.username);
window.location.href = "../app.html"
}ion.href = "../app.html"
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment