diff --git a/src/components/admin/pages/Perms.svelte b/src/components/admin/pages/Perms.svelte index a5b108f..63afdd4 100644 --- a/src/components/admin/pages/Perms.svelte +++ b/src/components/admin/pages/Perms.svelte @@ -23,6 +23,10 @@ import {players} from "@stores/stores.ts"; import {capitalize} from "../util.ts"; import {permsRepo} from "@repo/perms.ts"; + import {me} from "@stores/me.ts"; + import SWButton from "@components/styled/SWButton.svelte"; + import SWModal from "@components/styled/SWModal.svelte"; + import {userRepo} from "@repo/user.ts"; let search = ""; $: lowerCaseSearch = search.toLowerCase(); @@ -36,6 +40,10 @@ let prefixEdit = "PREFIX_NONE"; let activePerms: string[] = []; + let resetPasswordModal = false; + let resetPassword = ""; + let resetPasswordRepeat = ""; + function loadPlayer(id: number | null) { if (!id) { return; @@ -80,6 +88,19 @@ } let permsFuture = $permsRepo.listPerms(); + + function resetPW() { + if (resetPassword === resetPasswordRepeat) { + $userRepo.setPassword(selectedPlayer!, resetPassword); + } + resetResetPassword(); + } + + function resetResetPassword() { + resetPassword = ""; + resetPasswordRepeat = ""; + resetPasswordModal = false; + }
{error.toString()}
diff --git a/src/components/repo/user.ts b/src/components/repo/user.ts new file mode 100644 index 0000000..9b4e3b4 --- /dev/null +++ b/src/components/repo/user.ts @@ -0,0 +1,36 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2024 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see