2024-05-20 21:56:48 +02:00
|
|
|
/*
|
|
|
|
Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Backend
|
|
|
|
Copyright (C) 2024 Christian Fraß
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with this program. If not, see
|
|
|
|
<https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2024-05-20 12:20:59 +02:00
|
|
|
namespace _espe.api
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @todo ausgeklügelte Durchsatzratenbegrenzung
|
|
|
|
*/
|
|
|
|
export function register_member_password_change_execute(
|
|
|
|
rest_subject : lib_plankton.rest.type_rest
|
|
|
|
) : void
|
|
|
|
{
|
|
|
|
register<
|
|
|
|
{
|
|
|
|
token : string;
|
|
|
|
password_new : string;
|
|
|
|
},
|
2024-05-20 14:06:54 +02:00
|
|
|
Array<
|
|
|
|
{
|
|
|
|
incident : string;
|
|
|
|
details : Record<string, any>;
|
|
|
|
}
|
|
|
|
>
|
2024-05-20 12:20:59 +02:00
|
|
|
>(
|
|
|
|
rest_subject,
|
|
|
|
lib_plankton.http.enum_method.patch,
|
|
|
|
"/member/password_change/execute/:id",
|
|
|
|
{
|
|
|
|
"description": "Führt eine Passwort-Änderung für ein Mitglied durch",
|
|
|
|
"input_schema": () => ({
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"token": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password_new": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string",
|
|
|
|
"description": "das neue Passwort"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"additionalProperties": false,
|
|
|
|
"required": [
|
|
|
|
"token",
|
|
|
|
"password_new",
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
"output_schema": () => ({
|
2024-05-20 14:06:54 +02:00
|
|
|
"nullable": false,
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"incident": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"details": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {},
|
|
|
|
"additionalProperties": {
|
|
|
|
"nullable": true
|
|
|
|
},
|
|
|
|
"required": []
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"additionalProperties": false,
|
|
|
|
"required": [
|
|
|
|
"incident",
|
|
|
|
"details",
|
|
|
|
]
|
|
|
|
}
|
2024-05-20 12:20:59 +02:00
|
|
|
}),
|
|
|
|
"restriction": restriction_none,
|
2024-05-20 14:06:54 +02:00
|
|
|
"execution": ({"path_parameters": path_parameters, "input": input}) => {
|
2024-05-20 12:20:59 +02:00
|
|
|
const member_id : _espe.type.member_id = parseInt(path_parameters["id"]);
|
2024-05-20 14:06:54 +02:00
|
|
|
return (
|
|
|
|
_espe.service.member.password_change_execute(
|
|
|
|
member_id,
|
|
|
|
input.token,
|
|
|
|
input.password_new
|
|
|
|
)
|
|
|
|
.then(
|
|
|
|
flaws => Promise.resolve({
|
|
|
|
"status_code": (
|
|
|
|
(flaws.length <= 0)
|
|
|
|
? 200
|
|
|
|
: 409
|
|
|
|
),
|
|
|
|
"data": flaws
|
|
|
|
})
|
|
|
|
)
|
2024-05-20 12:20:59 +02:00
|
|
|
);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|