/* 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 . */ namespace _espe.api { /** * @todo ausgeklügelte Durchsatzratenbegrenzung * @todo captcha */ export function register_member_password_change_initialize( rest_subject : lib_plankton.rest_http.type_rest ) : void { lib_plankton.rest_http.register< { identifier : string; url_template : string; }, null >( rest_subject, lib_plankton.http.enum_method.post, _espe.api.full_path("/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}) => { if (input === null) { return Promise.reject(new Error("impossible")); } else { await _espe.service.member.password_change_initialize(input.identifier, input.url_template); return Promise.resolve({ "status_code": 200, "data": null }); } }, } ) } }