Add reset and update password for end users #120
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue/Task Number: 118
Closes #118
Overview
This PR adds 2 new endpoints to the SDK for users to reset and update their password.
Changes
Add
User.resetPassword(using client: client, params: prams, callback: callback)
UserResetPasswordParams
which takesemail
andredirectUrl
Add
User.updatePassword(using client: client, params: params, callback: callback)
UserUpdatePasswordParams
which takesemail
,token
,password
andpasswordConfirmation
Implementation Details
There is one important thing to note on this feature. When requesting a password reset, the developer needs to provide a
redirectURL
which is a formatted url that needs to be whitelisted in the eWallet to be used.This
redirectURL
must contains a{email}
and{token}
string in order for the server to replace them and creates a valid link that will be sent to the user's email.With the current server implementation it's only possible to provide a single link to this API. If the developer is implementing this functionality for a mobile app, there is a high chance that the user will open the link from his mobile, therefore it'd make sense to pass the app URI scheme to this
redirectURL
.This is totally possible (and will be implemented as an example in our POS client app), but it's important to note that not every mail applications support this kind of link (gmail app for iPhone doesn't, but the default iPhone mail app does).