Skip to content
Snippets Groups Projects
Commit 2381fc82 authored by Gustav Elmqvist's avatar Gustav Elmqvist
Browse files

merge

parents 57ea95e0 4c58f237
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,13 @@
}
.form-input {
width: 300px;
display: flex;
justify-content: space-between;
gap: 10px;
}
.form-input-welcome {
display: flex;
justify-content: space-between;
gap: 10px;
......@@ -82,4 +89,36 @@ input[type=text]:focus {
textarea {
overflow: hidden;
resize: none;
}
.message-board {
background-color: #f0e3d1;
overflow-y: scroll;
padding: 10px;
max-height: 40vh;
border-left: solid deeppink;
border-top-style: hidden;
border-right-style: hidden;
border-bottom-style: hidden;
}
/* width */
::-webkit-scrollbar {
width: 5px;
}
/* Track */
::-webkit-scrollbar-track {
background: none;
}
/* Handle */
::-webkit-scrollbar-thumb {
border-radius:5px;
background: #888;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555;
}
\ No newline at end of file
......@@ -11,11 +11,11 @@
<div class="form-elements" id="login">
<form id="loginform">
<h2>Login</h2>
<div class="form-input">
<div class="form-input-welcome">
<label for="email">Email</label>
<input type="text" id="email" name="email" size="18">
</div>
<div class="form-input">
<div class="form-input-welcome">
<label for="password">Password</label>
<input type="password" id="password" name="password" size="18">
</div>
......@@ -24,15 +24,15 @@
</form>
<form id="signupform">
<h2>Sign up here</h2>
<div class="form-input">
<div class="form-input-welcome">
<label for="fname">First name</label>
<input type="text" id="fname" name="fname" size="18">
</div>
<div class="form-input">
<div class="form-input-welcome">
<label for="lname">Family name</label>
<input type="text" id="lname" name="lname" size="18">
</div>
<div class="form-input">
<div class="form-input-welcome">
<label for="gender">Gender</label>
<select id="gender" name="gender" style="width:169;">
<option value="male">Male</option>
......@@ -41,27 +41,27 @@
</select>
</div>
<div class="form-input">
<div class="form-input-welcome">
<label for="city">City</label>
<input type="text" id="city" name="city" size="18">
</div>
<div class="form-input">
<div class="form-input-welcome">
<label for="country">Country</label>
<input type="text" id="country" name="country" size="18">
</div>
<div class="form-input">
<div class="form-input-welcome">
<label for="email">Email</label>
<input type="text" id="email" name="email" size="18">
</div>
<div class="form-input">
<div class="form-input-welcome">
<label for="password">Password</label>
<input type="password" id="password" name="password" size="18">
</div>
<div class="form-input">
<div class="form-input-welcome">
<label for="password2">Repeat PSW</label>
<input type="password" id="password2" name="password2" size="18">
</div>
<div class="form-input">
<div class="form-input-welcome">
<input type="submit" value="Sign Up">
</div>
<div id="message"></div>
......@@ -102,7 +102,7 @@
<div id="message3"></div>
<button id="reloadbutton">Reload board</button>
<div id="home-message-board">
<div id="home-message-board" class="message-board">
</div>
......@@ -137,7 +137,7 @@
<div id="message4"></div>
<button id="browse-reloadbutton">Reload board</button>
<div id="browse-message-board">
<div id="browse-message-board" class="message-board">
</div>
</div>
</div>
......
......@@ -13,14 +13,15 @@ class SignUp {
displayView = function() {
// the code required to display a view
};
window.onload = function() {
if (localStorage.getItem("logintoken") != null) {
loadProfileView();
} else {
loadWelcomeView();
}
};
window.onload = function() {
displayView();
};
loadWelcomeView = function() {
document.getElementById("pagecontent").innerHTML = "";
......@@ -49,7 +50,7 @@ loadWelcomeView = function() {
signupform["email"].setAttribute("placeholder", message.message);
} else {
localStorage.setItem("logintoken", message.data);
loadProfileView();
displayView();
}
}
}
......@@ -58,6 +59,7 @@ loadWelcomeView = function() {
loginform.addEventListener("submit", function(event) {
event.preventDefault();
<<<<<<< HEAD
var message = serverstub.signIn(loginform["email"].value, loginform["password"].value);
console.log(message);
if(!message.success) {
......@@ -68,6 +70,20 @@ loadWelcomeView = function() {
localStorage.setItem("logintoken", message.data);
loadProfileView();
}
=======
if (inputValidation("loginform")) {
var message = serverstub.signIn(loginform["email"].value, loginform["password"].value);
console.log(message);
if(!message.success) {
loginform["email"].value = "";
loginform["password"].value = "";
loginform["email"].setAttribute("placeholder", message.message);
} else {
localStorage.setItem("logintoken", message.data);
displayView();
}
}
>>>>>>> 4c58f2373c357a402d439c148abe89d13737eddd
})
}
......@@ -107,7 +123,7 @@ loadProfileView = function() {
} else {
localStorage.removeItem("logintoken");
}
loadWelcomeView();
displayView();
})
var userData = serverstub.getUserDataByToken(localStorage.getItem('logintoken')).data
......@@ -224,9 +240,6 @@ reloadBoard = function(board, email=null) {
messageHTML.appendChild(document.createElement('br'));
boardBox.appendChild(messageHTML);
boardBox.style.backgroundColor = "white";
boardBox.style.overflowY= "scroll";
boardBox.style.maxHeight = "45vh";
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment