Skip to content
Snippets Groups Projects
Commit ef7d572a authored by MaximeOLIVA's avatar MaximeOLIVA
Browse files

start lab3

parent 6f13960e
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -11,7 +11,7 @@ app = Flask(__name__)
@app.route("/", methods = ['GET'])
def hello_world():
return "<p>Hello, Lab_2!</p>", 200
return app.send_static_file("client.html"), 200
@app.route("/delete", methods = ['GET'])
......
......@@ -3,16 +3,16 @@
<html lang="en">
<head>
<title>Twidder</title>
<link href="client.css" type="text/css" rel="stylesheet">
<script src="client.js"></script>
<script src="serverstub.js"></script>
<link href="/static/client.css" type="text/css" rel="stylesheet">
<script src="/static/client.js"></script>
<script src="/static/serverstub.js"></script>
<script id="welcomeview" type="text/view">
<div id="center">
<img src="../Lab1_Ressources/wimage.png">
<img src="/static/wimage.png">
<div id="forms">
<form id="login" onsubmit="signIn(this); return false;">
<div><label for="email">Email</label><input class="logintexts" type="email" id="email" required></div>
<div><label for="password">Password</label><input class="logintexts" type="password" id="password" required></div>
<div><label for="email">Email</label><input class="logintexts" type="email" id="l_email" required></div>
<div><label for="password">Password</label><input class="logintexts" type="password" id="l_password" required></div>
<input value="Login" class="lbutton" type="submit">
</form>
<form id="signup" onsubmit="signUp(this); return false;">
......@@ -107,4 +107,4 @@
<div id="displayprofil"></div>
</body>
</html>
\ No newline at end of file
</html>
......@@ -42,7 +42,7 @@ function checkPasswords(formData){
return true;
}
}
function changePassword(formData) {
let oldPassword = formData.oldPassword.value;
......@@ -102,8 +102,8 @@ function signUp(formData) {
//---------------------------------------SIGN IN---------------------------------------
function signIn(formData) {
let username = formData.email.value;
let password = formData.password.value;
let username = formData.l_email.value;
let password = formData.l_password.value;
let tokens;
......@@ -112,7 +112,7 @@ function signIn(formData) {
let success = serverAnswer.success;
let message = serverAnswer.message;
let token = serverAnswer.data;
if(success) {
localStorage.setItem("token", token);
localStorage.setItem("email_username", username);
......@@ -164,7 +164,7 @@ function message_management(tab){
default:
email = localStorage.getItem("browsed_email");
}
if(message.length > 0) {
serverstub.postMessage(localStorage.getItem("token"), message, email);
display_wall(email, tab);
......@@ -189,7 +189,7 @@ function openTab(tabName) {
// Declare all variables
var i, tabcontent, tablinks;
localStorage.setItem("tab", tabName);
if(tabName != "browsePage") {
if(!(serverstub.getUserMessagesByEmail(localStorage.getItem("token"), localStorage.getItem("browsed_email")).success)) {
localStorage.removeItem("browsed_email");
......@@ -224,7 +224,7 @@ function openTab(tabName) {
function display_wall_info(email, tab) {
//check if we already have the data stored of if we have to call the server
let data_user = get_user_info(email, tab);
if(data_user.success) {
if(tab == "BP") {
browsecontent = document.getElementsByClassName("browsecontent");
......@@ -284,7 +284,7 @@ function display_wall(email, tab) {
document.getElementById(tab + i).style.marginBottom = "2px";
document.getElementById("writer" + tab + i).style.color = "grey";
}
}
function fills_data(tab, data_user) {
......@@ -294,4 +294,4 @@ function fills_data(tab, data_user) {
document.getElementById(tab + "_country").innerHTML = "Country = " + data_user.data.country;
document.getElementById(tab + "_city").innerHTML = "City = " + data_user.data.city;
document.getElementById(tab + "_gender").innerHTML = "Gender = " + data_user.data.gender;
}
\ No newline at end of file
}
Twidder (Lab3)/static/wimage.png

14 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment