@docbrasil/api-systemmanager 1.0.57 → 1.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/login.js +31 -0
- package/doc/api.md +24 -0
- package/package.json +1 -1
package/api/login.js
CHANGED
|
@@ -231,6 +231,37 @@ class Login {
|
|
|
231
231
|
throw ex;
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
237
|
+
* @description Recover the password
|
|
238
|
+
* @param {string} username The username or email
|
|
239
|
+
* @return {promise<object>}} data
|
|
240
|
+
* @return {boolean} data.success true|false
|
|
241
|
+
* @public
|
|
242
|
+
* @async
|
|
243
|
+
* @example
|
|
244
|
+
*
|
|
245
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
246
|
+
*
|
|
247
|
+
* // Params of the instance
|
|
248
|
+
* const params = {...}
|
|
249
|
+
* const api = new API(params);
|
|
250
|
+
* const { success } = await api.login.recover('myusername');
|
|
251
|
+
*/
|
|
252
|
+
async recover(username) {
|
|
253
|
+
const self = this;
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
Joi.assert(username, Joi.string().required());
|
|
257
|
+
|
|
258
|
+
const url = `users/${username}/sendResetEmail`;
|
|
259
|
+
const apiCall = self._client.get(url);
|
|
260
|
+
return self._returnData(await apiCall);
|
|
261
|
+
} catch (ex) {
|
|
262
|
+
throw ex;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
234
265
|
}
|
|
235
266
|
|
|
236
267
|
export default Login;
|
package/doc/api.md
CHANGED
|
@@ -1250,6 +1250,7 @@ Login manager
|
|
|
1250
1250
|
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1251
1251
|
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1252
1252
|
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1253
|
+
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1253
1254
|
|
|
1254
1255
|
<a name="Login+facebook"></a>
|
|
1255
1256
|
|
|
@@ -1383,6 +1384,29 @@ const api = new API(params);
|
|
|
1383
1384
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1384
1385
|
const { success } = await api.login.logout(session);
|
|
1385
1386
|
```
|
|
1387
|
+
<a name="Login+recover"></a>
|
|
1388
|
+
|
|
1389
|
+
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1390
|
+
Recover the password
|
|
1391
|
+
|
|
1392
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1393
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1394
|
+
**Access**: public
|
|
1395
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1396
|
+
|
|
1397
|
+
| Param | Type | Description |
|
|
1398
|
+
| --- | --- | --- |
|
|
1399
|
+
| username | <code>string</code> | The username or email |
|
|
1400
|
+
|
|
1401
|
+
**Example**
|
|
1402
|
+
```js
|
|
1403
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1404
|
+
|
|
1405
|
+
// Params of the instance
|
|
1406
|
+
const params = {...}
|
|
1407
|
+
const api = new API(params);
|
|
1408
|
+
const { success } = await api.login.recover('myusername');
|
|
1409
|
+
```
|
|
1386
1410
|
<a name="Session"></a>
|
|
1387
1411
|
|
|
1388
1412
|
## Session
|
package/package.json
CHANGED