Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit 6c6515e

Browse files
authored
Merge pull request #366 from Fifciu/feature/#-Change-Password
Feature/# change password
2 parents 05998f8 + bf74066 commit 6c6515e

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- The support for `SearchQuery` instead of the ElasticSearch DSL as for the input to `/api/catalog` - using `storefront-query-builder` package - @pkarw - https://github.com/DivanteLtd/vue-storefront/issues/2167
1414
- Create attribute service that allows to fetch attributes with specific options - used for products aggregates - @gibkigonzo (https://github.com/DivanteLtd/vue-storefront/pull/4001, https://github.com/DivanteLtd/mage2vuestorefront/pull/99)
1515
- Add ElasticSearch client support for HTTP authentication - @cewald (#397)
16+
- Endpoint for reset password with reset token. Only for Magento 2 - @Fifciu
1617

1718
### Fixed
1819
- add es7 support for map url module and fixed default index for es config - @gibkigonzo
@@ -26,7 +27,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2627
- Add product processor to new URL mapper endpoint #401 - @cewald (#401, #403)
2728
- Add fallback for `sourcePriceInclTax` and `finalPriceInclTax` in `magento1` platform - @cewald (#398)
2829

29-
3030
## [1.11.0-rc.1] - 2019.10.03
3131

3232
### Added

src/api/user.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,30 @@ export default ({config, db}) => {
217217
})
218218
});
219219

220+
/**
221+
* POST for changing user's password after reset password with the token
222+
*/
223+
userApi.post('/create-password', (req, res) => {
224+
if (!req.body.email) {
225+
return apiStatus(res, 'email not provided', 500);
226+
}
227+
if (!req.body.resetToken) {
228+
return apiStatus(res, 'resetToken not provided', 500);
229+
}
230+
if (!req.body.newPassword) {
231+
return apiStatus(res, 'newPassword not provided', 500);
232+
}
233+
234+
const userProxy = _getProxy(req);
235+
userProxy
236+
.resetPasswordUsingResetToken(req.body)
237+
.then(result => {
238+
apiStatus(res, result, 200);
239+
})
240+
.catch(err => {
241+
apiStatus(res, err, 500);
242+
});
243+
})
244+
220245
return userApi
221246
}

src/platform/magento2/user.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ class UserProxy extends AbstractUserProxy {
3535
changePassword (passwordData) {
3636
return this.api.customers.changePassword(passwordData)
3737
}
38+
39+
resetPasswordUsingResetToken (resetData) {
40+
return this.api.customers.resetPasswordUsingResetToken(resetData)
41+
}
3842
}
3943

4044
module.exports = UserProxy

0 commit comments

Comments
 (0)