backend/source/api/actions/member_password_change_initialize.ts

76 lines
2.2 KiB
TypeScript
Raw Normal View History

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/>.
*/
namespace _espe.api
{
/**
* @todo ausgeklügelte Durchsatzratenbegrenzung
* @todo captcha
*/
export function register_member_password_change_initialize(
rest_subject : lib_plankton.rest.type_rest
) : void
{
register<
{
identifier : string;
url_template : string;
},
null
>(
rest_subject,
lib_plankton.http.enum_method.post,
"/member/password_change/initialize",
{
"description": "Versucht dem gegebenen Identifikator ein Mitglied zuzuordnen und sendet dem ermittelten Mitglied einen Passwort-Änderungs-Verweis an die hinterlegte private E-Mail-Adresse",
"input_schema": () => ({
"nullable": false,
"type": "object",
"properties": {
"identifier": {
"nullable": false,
"type": "string",
"description": "Anmelde-Name oder persönliche E-Mail-Adresse des Mitglieds"
},
"url_template": {
"nullable": false,
"type": "string",
"description": "Schablone für URL; Platz-Halter: id,token"
},
},
"additionalProperties": false,
"required": [
"identifier",
"url_template",
]
}),
"output_schema": () => ({
"nullable": true
}),
"restriction": restriction_none,
"execution": async ({"input": input}) => {
await _espe.service.member.password_change_initialize(input.identifier, input.url_template);
return Promise.resolve({
"status_code": 200,
"data": null
});
},
}
)
}
}