From 5dbb0f52638d765bc61283a94e9483e070dcd4d3 Mon Sep 17 00:00:00 2001 From: tniezg Date: Mon, 7 Jun 2021 12:56:16 +0200 Subject: [PATCH] Add password reset descriptions to README --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 044344b9..e616a898 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ Developed and maintained by: - [refreshToken](#refreshToken) - [Account](#account) - [create](#create) + - [forgotPassword](#forgotPassword) + - [resetPassword](#resetPassword) - [update](#update) - [accountInfo](#accountInfo) - [creditCardsList](#creditCardsList) @@ -130,7 +132,7 @@ The specific type of error returned by `fail()` can be determined using [`instan ## Tokens -Most endpoints require a token for authentication. It can be either an Order Token or Bearer Token. +Most endpoints require a token for authentication. It can be an Order Token, Bearer Token or a Confirmation Token. ### Order token @@ -155,6 +157,10 @@ const response = await client.authentication.getToken({ const bearerToken: string = response.success().access_token ``` +### Confirmation token + +Identifies a user for a single operation. For example, to reset their account's password. Confirmation Tokens are single-use and may have an expiration date. + ## Endpoints Spree Storefront API SDK contains each endpoint according to [Spree Guides](https://guides.spreecommerce.org/api/v2/storefront) @@ -281,6 +287,62 @@ data: { const response = await client.account.confirm('2xssfC9Hzf8DJXyRZGmB') ``` +### `forgotPassword` + +Sends an account recovery link to the provided email address. The link allows resetting the password for the account. + +**Parameters schema:** + +```ts +user: { + email: string +} +``` + +**Success response schema:** [Success schema](#success-schema) + +**Failure response schema:** [Error schema](#error-schema) + +**Example:** + +```ts +const response = await client.account.forgotPassword({ + user: { + email: 'spree@example.com' + } +}) +``` + +### `resetPassword` + +Changes the password associated with the account using an account recovery token. + +**Parameters schema:** + +```ts +user: { + password: string + password_confirmation: string +} +``` + +**Required token:** [Confirmation token](#confirmation-token) + +**Success response schema:** [Success schema](#success-schema) + +**Failure response schema:** [Error schema](#error-schema) + +**Example:** + +```ts +const response = await client.account.resetPassword('7381273269536713689562374856', { + user: { + password: '123!@#asdASD', + password_confirmation: '123!@#asdASD' + } +}) +``` + ### `update` Updates account and returns its attributes.