clean: rename: authentification to authenticate

This commit is contained in:
starnakin 2024-02-13 13:59:16 +01:00
parent 0244ec0e51
commit 6df27eeadf
16 changed files with 34 additions and 34 deletions

View File

@ -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<Boolean>}
*/
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<Boolean>}
*/
async _test_logged()

View File

@ -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}`;

View File

@ -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}`;

View File

@ -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');
});

View File

@ -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"

View File

@ -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");

View File

@ -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) {

View File

@ -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);

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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'));

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{