From 1b49de62869e9a5554dc27445fa8da536cedd934 Mon Sep 17 00:00:00 2001 From: Raphix Date: Mon, 8 Jan 2024 11:26:56 +0100 Subject: [PATCH] Version 0.6.1 - Ajout du clear token --- bin/servers.js | 5 +++++ bin/users.js | 12 ++++++++++++ package.json | 2 +- public/javascripts/basics.js | 11 +++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/bin/servers.js b/bin/servers.js index 44aedd1..336917a 100644 --- a/bin/servers.js +++ b/bin/servers.js @@ -187,6 +187,11 @@ module.exports.serverIO = function(server) { PostRequest("US_EDIT", async (settings) => { PostAnswer("US_EDIT", await users.editUser(settings)) }) + + PostRequest("US_CLEAR_TOKENS", async (settings) => { + + PostAnswer("US_CLEAR_TOKENS", await users.clearTokens(settings)) + }) } if(user.checkPermission("SETTINGS")) { diff --git a/bin/users.js b/bin/users.js index 86d2f3b..dd2f29e 100644 --- a/bin/users.js +++ b/bin/users.js @@ -340,6 +340,12 @@ module.exports.User = class { this.register() } + clearTokens() { + this.#sync() + this.tokens = [] + this.register() + } + #sync() { for(var userGet of usersList.keys()) { @@ -459,6 +465,12 @@ module.exports.editUser = function(settings) { } } +module.exports.clearTokens = function(username) { + + const user = this.fetchUsers().get(username) + user.clearTokens() +} + /** * diff --git a/package.json b/package.json index f4961a8..2803d9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "neutral", - "version": "0.6.0", + "version": "0.6.1", "description": "Panel d'administration de Raphix", "main": "index.js", "scripts": { diff --git a/public/javascripts/basics.js b/public/javascripts/basics.js index 5ba014b..860fd92 100644 --- a/public/javascripts/basics.js +++ b/public/javascripts/basics.js @@ -1073,6 +1073,17 @@ class User { const returnInfo = new TextResponse(`${this.username}_returninfo`) const editPermissions = new Array() + + editTokensButton.addEventListener("click", () => { + const request = post(`US_CLEAR_TOKENS`, this.username) + request.then((answer) => { + if(answer == "NO_TOKENS") { + returnInfo.err("Aucun token n'a été généré pour cet utilisateur") + } else { + returnInfo.info("Les tokens ont été éffacés avec succès") + } + }) + }) editPermissions.push(getID(`${this.username}_perm_FILES_EXPLORER`))