Skip to content

Commit 08b59fa

Browse files
committed
[FIX] a few quirks that could of hindered the proper functioning of the mockup
1 parent fd4a9bd commit 08b59fa

File tree

10 files changed

+29
-15
lines changed

10 files changed

+29
-15
lines changed
128 Bytes
Binary file not shown.

html/assets/js/callback/redirect.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function check_callback() {
4141
if (user_info.status != 200) {
4242
console.log("Login failed");
4343
logout();
44-
window.location.href = home_page;
44+
window.location.pathname = home_page;
4545
return;
4646
}
4747
const user_id = user_info.resp.id;
@@ -54,15 +54,15 @@ async function check_callback() {
5454
console.log(`typeof email: ${typeof user_email}`);
5555
if (!user_name || user_name === "" || user_name === "undefined" || user_name === "null" || user_name === null || user_name === undefined) {
5656
console.log(`Redirecting to ${user_password}`);
57-
window.location.href = user_password;
57+
window.location.pathname = user_password;
5858
return;
5959
}
6060
window.cookie_manager.create(user_username_cookie_name, user_name);
6161
console.log(`Redirecting to ${dashboard_page}`);
62-
window.location.href = dashboard_page;
62+
window.location.pathname = dashboard_page;
6363
} else {
6464
console.log("Login failed");
65-
window.location.href = home_page;
65+
window.location.pathname = home_page;
6666
}
6767
}
6868

html/assets/js/dashboard/logout.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ async function logout() {
1717
window.cookie_manager.remove(window.constants.user_username_cookie_name);
1818
window.cookie_manager.remove(window.constants.user_id_cookie_name);
1919
window.indexedDB_manager.remove(window.constants.widget_cookie_name);
20-
window.location.href = window.constants.home_page;
20+
window.location.pathname = window.constants.home_page;
2121
console.log("logout finished");
2222
}
23+
24+
async function logout_pro() {
25+
console.log("logout_pro called");
26+
const response = await window.update_server.logUserOut();
27+
if (response.ok) {
28+
console.log("Logout successful:", response);
29+
} else {
30+
console.log("Logout failed:", response);
31+
}
32+
window.cookie_manager.remove(window.constants.user_token_cookie_name);
33+
window.cookie_manager.remove(window.constants.user_username_cookie_name);
34+
window.cookie_manager.remove(window.constants.user_id_cookie_name);
35+
window.indexedDB_manager.remove(window.constants.widget_cookie_name);
36+
window.location.pathname = "/professional.html";
37+
console.log("logout_pro finished");
38+
}

html/assets/js/login/log_user_in.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ async function log_user_in() {
1111
const password = document.getElementById("loginPassword").value;
1212

1313
console.log("window.location", window.location);
14-
console.log("window.location.href", window.location.href);
1514
console.log("window.location.origin", window.location.origin);
1615
console.log("window.location.host", window.location.host);
1716
console.log("window.location.hostname", window.location.hostname);

html/assets/js/login/register_user.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ async function register_user() {
1313
const password_confirmation = document.getElementById("registerPasswordConfirmation").value;
1414

1515
console.log("window.location", window.location);
16-
console.log("window.location.href", window.location.href);
1716
console.log("window.location.origin", window.location.origin);
1817
console.log("window.location.host", window.location.host);
1918
console.log("window.location.hostname", window.location.hostname);
@@ -37,7 +36,7 @@ async function register_user() {
3736

3837
if (response.ok) {
3938
console.log("Registration successful:", response);
40-
// window.location.href = window.constants.dashboard_page;
39+
// window.location.pathname = window.constants.dashboard_page;
4140
window.location.pathname = dashboard;
4241
} else {
4342
update_error_message("Registration failed: " + response.message);

html/assets/js/password/get_sso_details.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ async function get_sso_details() {
2020
if (response.ok) {
2121
console.log("Registration successful:", response);
2222
window.cookie_manager.create(user_username_cookie_name, username);
23-
window.location.href = window.constants.dashboard_page;
23+
window.location.pathname = window.constants.dashboard_page;
2424
} else {
2525
update_error_message("Registration failed: " + response.message);
26-
window.location.href = window.constants.home_page;
26+
window.location.pathname = window.constants.home_page;
2727
}
2828
};
2929

html/routes/pro/creation/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<path d="M8 15A7 7 0 1 0 8 1zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16"></path>
148148
</svg>Auto</a></div>
149149
</div><select id="fontSelector" onchange="updateFont(this);"></select>
150-
<aside><button class="button_desing" type="button" onclick="logout();">Logout</button></aside>
150+
<aside><button class="button_desing" type="button" onclick="logout_pro();">Logout</button></aside>
151151
</section><!-- End: Header -->
152152
<p style="background-color:yellow;color:black;">Ceci est un site de <strong>démonstration</strong>, vos données personnelles ne seront enregistré que sur votre ordinateur.<br>Le concepteur fourni est à titre d'exemple, ce n'est qu'un <strong>apperçu</strong> d'une des fonctionnalités de cette page.</p><!-- Start: controls -->
153153
<section>

html/routes/pro/discuter/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
<path d="M8 15A7 7 0 1 0 8 1zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16"></path>
150150
</svg>Auto</a></div>
151151
</div><select id="fontSelector" onchange="updateFont(this);"></select>
152-
<aside><button class="button_desing" type="button" onclick="logout();">Logout</button></aside>
152+
<aside><button class="button_desing" type="button" onclick="logout_pro();">Logout</button></aside>
153153
</section>
154154
<section id="cookie_banner"></section>
155155
<section class="forumFrame">

html/routes/pro/suivi/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
<path d="M8 15A7 7 0 1 0 8 1zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16"></path>
150150
</svg>Auto</a></div>
151151
</div><select id="fontSelector" onchange="updateFont(this);"></select>
152-
<aside><button class="button_desing" type="button" onclick="logout();">Logout</button></aside>
152+
<aside><button class="button_desing" type="button" onclick="logout_pro();">Logout</button></aside>
153153
</section>
154154
<section class="forumFrame">
155155
<aside class="aside-left">

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<body>
1111
<p>If you are not redirected automatically, follow this <a id="redirect" href="./html/">link</a>.</p>
1212
<script type="text/javascript">
13-
const url = "./html";
13+
const url = "/html";
1414
document.getElementById("redirect").href = url;
1515
function redirect() {
16-
window.location.href = url;
16+
window.location.pathname = url;
1717
}
1818
window.onload = redirect;
1919
</script>

0 commit comments

Comments
 (0)