From 6df27eeadf0dda6bdf63777da4fd8e1f5dc18ca4 Mon Sep 17 00:00:00 2001 From: starnakin Date: Tue, 13 Feb 2024 13:59:16 +0100 Subject: [PATCH] clean: rename: authentification to authenticate --- frontend/static/js/api/client.js | 6 +++--- frontend/static/js/api/matchmaking.js | 2 +- frontend/static/js/api/tournament/tournament.js | 2 +- frontend/static/js/index.js | 8 ++++---- frontend/static/js/views/HomeView.js | 4 ++-- frontend/static/js/views/MatchMakingView.js | 4 ++-- frontend/static/js/views/ProfilePageView.js | 4 ++-- frontend/static/js/views/Search.js | 2 +- frontend/static/js/views/SettingsView.js | 6 +++--- ...uthentifiedView.js => AbstractAuthenticatedView.js} | 2 +- ...entifiedView.js => AbstractNonAuthenticatedView.js} | 2 +- .../{AuthentifyView.js => AuthenficationView.js} | 10 +++++----- frontend/static/js/views/accounts/LogoutView.js | 4 ++-- .../static/js/views/tournament/TournamentCreateView.js | 4 ++-- .../static/js/views/tournament/TournamentPageView.js | 4 ++-- .../static/js/views/tournament/TournamentsListView.js | 4 ++-- 16 files changed, 34 insertions(+), 34 deletions(-) rename frontend/static/js/views/abstracts/{AbstractAuthentifiedView.js => AbstractAuthenticatedView.js} (87%) rename frontend/static/js/views/abstracts/{AbstractNonAuthentifiedView.js => AbstractNonAuthenticatedView.js} (87%) rename frontend/static/js/views/accounts/{AuthentifyView.js => AuthenficationView.js} (95%) diff --git a/frontend/static/js/api/client.js b/frontend/static/js/api/client.js index 5df70bf..f414a15 100644 --- a/frontend/static/js/api/client.js +++ b/frontend/static/js/api/client.js @@ -53,7 +53,7 @@ class Client this.tournaments = new Tourmanents(this); /** - * @type {Boolean} A private var represent if the is is log NEVER USE IT use await isAuthentificated() + * @type {Boolean} A private var represent if the is is log NEVER USE IT use await isAuthenticated() */ this._logged = undefined; @@ -80,7 +80,7 @@ class Client * The only right way to determine is the user is logged * @returns {Promise} */ - async isAuthentificate() + async isAuthenticate() { if (this._logged == undefined) this._logged = await this._test_logged(); @@ -236,7 +236,7 @@ class Client } /** - * Determine if the user is logged. NEVER USE IT, USE isAuthentificated() + * Determine if the user is logged. NEVER USE IT, USE isAuthenticated() * @returns {Promise} */ async _test_logged() diff --git a/frontend/static/js/api/matchmaking.js b/frontend/static/js/api/matchmaking.js index c63dd4d..5a6a651 100644 --- a/frontend/static/js/api/matchmaking.js +++ b/frontend/static/js/api/matchmaking.js @@ -23,7 +23,7 @@ class MatchMaking */ async start(receive_func, disconnect_func, mode) { - if (!await this.client.isAuthentificate()) + if (!await this.client.isAuthenticate()) return null; let url = `${window.location.protocol[4] === 's' ? 'wss' : 'ws'}://${window.location.host}/ws/matchmaking/${mode}`; diff --git a/frontend/static/js/api/tournament/tournament.js b/frontend/static/js/api/tournament/tournament.js index 46a9502..e8782ea 100644 --- a/frontend/static/js/api/tournament/tournament.js +++ b/frontend/static/js/api/tournament/tournament.js @@ -120,7 +120,7 @@ class Tourmanent */ async join(receive_func, disconnect_func) { - if (!await this.client.isAuthentificate()) + if (!await this.client.isAuthenticate()) return null; let url = `${window.location.protocol[4] === 's' ? 'wss' : 'ws'}://${window.location.host}/ws/tournaments/${this.id}`; diff --git a/frontend/static/js/index.js b/frontend/static/js/index.js index 90c789e..1eec401 100644 --- a/frontend/static/js/index.js +++ b/frontend/static/js/index.js @@ -16,7 +16,7 @@ import MatchMakingView from "./views/MatchMakingView.js"; import TournamentPageView from "./views/tournament/TournamentPageView.js"; import TournamentsView from "./views/tournament/TournamentsListView.js"; import TournamentCreateView from "./views/tournament/TournamentCreateView.js"; -import AuthentificateView from "./views/accounts/AuthentifyView.js"; +import AuthentifyView from "./views/accounts/AuthenficationView.js"; let client = new Client(location.origin); let lang = client.lang; @@ -75,8 +75,8 @@ const router = async(uri) => { { path: "/tournaments/create", view: TournamentCreateView }, { path: "/tournaments/:id", view: TournamentPageView }, { path: "/tournaments/", view: TournamentsView }, - { path: "/login", view: AuthentificateView }, - { path: "/register", view: AuthentificateView }, + { path: "/login", view: AuthentifyView }, + { path: "/register", view: AuthentifyView }, { path: "/logout", view: LogoutView }, { path: "/search", view: Search }, { path: "/home", view: HomeView }, @@ -152,7 +152,7 @@ document.addEventListener("DOMContentLoaded", async () => { document.querySelector(`#languageSelector > [value=${lang.chosenLang}]`) ?.classList.add('active'); - await client.isAuthentificate(); + await client.isAuthenticate(); router(location.pathname); document.querySelector('a[href=\'' + location.pathname + '\']')?.classList.add('active'); }); diff --git a/frontend/static/js/views/HomeView.js b/frontend/static/js/views/HomeView.js index 8ac3ea2..9f38a9a 100644 --- a/frontend/static/js/views/HomeView.js +++ b/frontend/static/js/views/HomeView.js @@ -1,7 +1,7 @@ import { lang } from "../index.js"; -import AbstractAuthentificateView from "./abstracts/AbstractAuthentifiedView.js"; +import AbstractAuthenticatedView from "./abstracts/AbstractAuthenticatedView.js"; -export default class extends AbstractAuthentificateView { +export default class extends AbstractAuthenticatedView { constructor(params) { super(params, lang.get('homeWindowTitle', 'Home')); this.redirect_url = "/login" diff --git a/frontend/static/js/views/MatchMakingView.js b/frontend/static/js/views/MatchMakingView.js index eb084d3..0414fa2 100644 --- a/frontend/static/js/views/MatchMakingView.js +++ b/frontend/static/js/views/MatchMakingView.js @@ -1,8 +1,8 @@ import { client, navigateTo } from "../index.js"; import { clear, fill_errors } from "../utils/formUtils.js"; -import AbstractAuthentifiedView from "./abstracts/AbstractAuthentifiedView.js"; +import AbstractAuthenticatedView from "./abstracts/AbstractAuthenticatedView.js"; -export default class extends AbstractAuthentifiedView { +export default class extends AbstractAuthenticatedView { constructor(params) { super(params, "Matchmaking"); diff --git a/frontend/static/js/views/ProfilePageView.js b/frontend/static/js/views/ProfilePageView.js index 9d21d26..9a3f2bf 100644 --- a/frontend/static/js/views/ProfilePageView.js +++ b/frontend/static/js/views/ProfilePageView.js @@ -44,7 +44,7 @@ export default class extends AbstractView { async blockButton() { // Block option - if (await client.isAuthentificate() === false) + if (await client.isAuthenticate() === false) return; if (client.me.id != this.user_id) { @@ -72,7 +72,7 @@ export default class extends AbstractView { } async friendButton() { - if (await client.isAuthentificate() === false) + if (await client.isAuthenticate() === false) return; if (client.me.id != this.user_id) { diff --git a/frontend/static/js/views/Search.js b/frontend/static/js/views/Search.js index 5cab730..61d1c93 100644 --- a/frontend/static/js/views/Search.js +++ b/frontend/static/js/views/Search.js @@ -21,7 +21,7 @@ export default class extends AbstractView { async postInit() { - let logged = await client.isAuthentificate(); + let logged = await client.isAuthenticate(); let profiles = await client.profiles.all(); //console.log(client.notice.data); diff --git a/frontend/static/js/views/SettingsView.js b/frontend/static/js/views/SettingsView.js index 82f691a..c2b4410 100644 --- a/frontend/static/js/views/SettingsView.js +++ b/frontend/static/js/views/SettingsView.js @@ -1,8 +1,8 @@ import { client, navigateTo } from "../index.js"; import { clear, fill_errors } from "../utils/formUtils.js"; -import AbstractAuthentificateView from "./abstracts/AbstractAuthentifiedView.js"; +import AbstractAuthenticatedView from "./abstracts/AbstractAuthenticatedView.js"; -export default class extends AbstractAuthentificateView +export default class extends AbstractAuthenticatedView { constructor(params) { @@ -36,7 +36,7 @@ export default class extends AbstractAuthentificateView let response_data = await client.account.delete(current_password); - console.log(await client.isAuthentificate()) + console.log(await client.isAuthenticate()) if (response_data === null || response_data === "user deleted") { navigateTo("/login"); diff --git a/frontend/static/js/views/abstracts/AbstractAuthentifiedView.js b/frontend/static/js/views/abstracts/AbstractAuthenticatedView.js similarity index 87% rename from frontend/static/js/views/abstracts/AbstractAuthentifiedView.js rename to frontend/static/js/views/abstracts/AbstractAuthenticatedView.js index eff0e36..a051f4f 100644 --- a/frontend/static/js/views/abstracts/AbstractAuthentifiedView.js +++ b/frontend/static/js/views/abstracts/AbstractAuthenticatedView.js @@ -8,7 +8,7 @@ export default class extends AbstractRedirectView{ async redirect() { - if (await client.isAuthentificate() === false) + if (await client.isAuthenticate() === false) { navigateTo(this.redirect_url); return 1; diff --git a/frontend/static/js/views/abstracts/AbstractNonAuthentifiedView.js b/frontend/static/js/views/abstracts/AbstractNonAuthenticatedView.js similarity index 87% rename from frontend/static/js/views/abstracts/AbstractNonAuthentifiedView.js rename to frontend/static/js/views/abstracts/AbstractNonAuthenticatedView.js index cf28f45..b0d43da 100644 --- a/frontend/static/js/views/abstracts/AbstractNonAuthentifiedView.js +++ b/frontend/static/js/views/abstracts/AbstractNonAuthenticatedView.js @@ -8,7 +8,7 @@ export default class extends AbstractRedirectView{ async redirect() { - if (await client.isAuthentificate() === false) + if (await client.isAuthenticate() === false) return 0; navigateTo(this.redirect_url); return 1; diff --git a/frontend/static/js/views/accounts/AuthentifyView.js b/frontend/static/js/views/accounts/AuthenficationView.js similarity index 95% rename from frontend/static/js/views/accounts/AuthentifyView.js rename to frontend/static/js/views/accounts/AuthenficationView.js index cca1015..fffd54c 100644 --- a/frontend/static/js/views/accounts/AuthentifyView.js +++ b/frontend/static/js/views/accounts/AuthenficationView.js @@ -1,9 +1,9 @@ import { client, lang, navigateTo } from "../../index.js"; import { clear, fill_errors } from "../../utils/formUtils.js"; -import AbstractNonAuthentifiedView from "../abstracts/AbstractNonAuthentifiedView.js"; +import AbstractNonAuthenticatedView from "../abstracts/AbstractNonAuthenticatedView.js"; -export default class extends AbstractNonAuthentifiedView +export default class extends AbstractNonAuthenticatedView { constructor(params, lastUrlBeforeLogin = '/home') { @@ -29,7 +29,7 @@ export default class extends AbstractNonAuthentifiedView let new_mode = location.pathname.slice(1); this.update_mode(new_mode); - document.getElementById("button").onclick = this.authenticate.bind(this); + document.getElementById("button").onclick = this.authencation.bind(this); let username_input = document.getElementById('username-input'), password_input = document.getElementById('password-input'); @@ -37,7 +37,7 @@ export default class extends AbstractNonAuthentifiedView [username_input, password_input].forEach(input => { input.addEventListener('keydown', async ev => { if (ev.key === 'Enter') - await this.authenticate.bind(this)() + await this.authencation.bind(this)() }); }); } @@ -114,7 +114,7 @@ export default class extends AbstractNonAuthentifiedView /** * @returns {Promise} */ - async authenticate() + async authencation() { let username = document.getElementById("username-input").value, password = document.getElementById("password-input").value; diff --git a/frontend/static/js/views/accounts/LogoutView.js b/frontend/static/js/views/accounts/LogoutView.js index 0007ade..d5307f1 100644 --- a/frontend/static/js/views/accounts/LogoutView.js +++ b/frontend/static/js/views/accounts/LogoutView.js @@ -1,7 +1,7 @@ import { client, lang, navigateTo } from "../../index.js"; -import AbstractAuthentifiedView from "../abstracts/AbstractAuthentifiedView.js"; +import AbstractAuthenticatedView from "../abstracts/AbstractAuthenticatedView.js"; -export default class extends AbstractAuthentifiedView +export default class extends AbstractAuthenticatedView { constructor(params, lastPageUrl = '/login') { super(params, lang.get('logoutWindowTitle', 'Logout')); diff --git a/frontend/static/js/views/tournament/TournamentCreateView.js b/frontend/static/js/views/tournament/TournamentCreateView.js index 9cfc1a4..8983071 100644 --- a/frontend/static/js/views/tournament/TournamentCreateView.js +++ b/frontend/static/js/views/tournament/TournamentCreateView.js @@ -1,8 +1,8 @@ import {client, navigateTo} from "../../index.js"; import { clear, fill_errors } from "../../utils/formUtils.js"; -import AbstractAuthentifiedView from "../abstracts/AbstractAuthentifiedView.js"; +import AbstractAuthenticatedView from "../abstracts/AbstractAuthenticatedView.js"; -export default class extends AbstractAuthentifiedView +export default class extends AbstractAuthenticatedView { constructor(params) { diff --git a/frontend/static/js/views/tournament/TournamentPageView.js b/frontend/static/js/views/tournament/TournamentPageView.js index 034d27b..2d66bfa 100644 --- a/frontend/static/js/views/tournament/TournamentPageView.js +++ b/frontend/static/js/views/tournament/TournamentPageView.js @@ -1,7 +1,7 @@ import {client, navigateTo} from "../../index.js"; -import AbstractAuthentifiedView from "../abstracts/AbstractAuthentifiedView.js"; +import AbstractAuthenticatedView from "../abstracts/AbstractAuthenticatedView.js"; -export default class extends AbstractAuthentifiedView +export default class extends AbstractAuthenticatedView { constructor(params) { diff --git a/frontend/static/js/views/tournament/TournamentsListView.js b/frontend/static/js/views/tournament/TournamentsListView.js index d232698..eae0451 100644 --- a/frontend/static/js/views/tournament/TournamentsListView.js +++ b/frontend/static/js/views/tournament/TournamentsListView.js @@ -1,7 +1,7 @@ import {client} from "../../index.js"; -import AbstractAuthentifiedView from "../abstracts/AbstractAuthentifiedView.js"; +import AbstractAuthenticatedView from "../abstracts/AbstractAuthenticatedView.js"; -export default class extends AbstractAuthentifiedView +export default class extends AbstractAuthenticatedView { constructor(params) {