blob: 9d6f0dcbc29ab6edc4525be74349db3a9c830115 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { api_base } from "$lib/configuration";
import { http_get_async, http_post_async, type InternalFetchResponse } from "../_fetch";
export const http_password_reset_request = {
create_forgot_password_request(username: string): Promise<InternalFetchResponse> {
if (!username) throw new Error("Username is empty");
return http_get_async(api_base("_/forgot-password-requests/create?username=" + username));
},
check_forgot_password_request(public_id: string): Promise<InternalFetchResponse> {
if (!public_id) throw new Error("Id is empty");
return http_get_async(api_base("_/forgot-password-requests/is-valid?id=" + public_id));
},
fulfill_forgot_password_request(public_id: string, newPassword: string): Promise<InternalFetchResponse> {
if (!public_id) throw new Error("Id is empty");
return http_post_async(api_base("_/forgot-password-requests/fulfill"), { id: public_id, newPassword });
},
}
|