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
* @todo captcha
* /
export function register_member_password_change_initialize (
2025-04-03 06:19:19 +00:00
rest_subject : lib_plankton.rest_http.type_rest
2024-05-20 12:20:59 +02:00
) : void
{
2025-04-03 06:19:19 +00:00
lib_plankton . rest_http . register <
2024-05-20 12:20:59 +02:00
{
identifier : string ;
url_template : string ;
} ,
null
> (
rest_subject ,
lib_plankton . http . enum_method . post ,
2025-04-03 06:19:19 +00:00
_espe . api . full_path ( "/member/password_change/initialize" ) ,
2024-05-20 12:20:59 +02:00
{
2025-04-03 06:19:19 +00:00
"description" : ( ) = > "Versucht dem gegebenen Identifikator ein Mitglied zuzuordnen und sendet dem ermittelten Mitglied einen Passwort-Änderungs-Verweis an die hinterlegte private E-Mail-Adresse" ,
2024-05-20 12:20:59 +02:00
"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
} ) ,
2025-04-03 06:19:19 +00:00
"restriction" : ( ) = > restriction_none ,
"execution" : ( ) = > async ( { "input" : input } ) = > {
2024-05-27 17:32:42 +02:00
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
} ) ;
}
2024-05-20 12:20:59 +02:00
} ,
}
)
}
}