Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reset and update password for end users #120

Merged
merged 7 commits into from Mar 15, 2019

Conversation

mederic-p
Copy link
Contributor

Issue/Task Number: 118
Closes #118

Based on #117 until merged

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)

    • Add UserResetPasswordParams which takes email and redirectUrl
  • Add User.updatePassword(using client: client, params: params, callback: callback)

    • Add UserUpdatePasswordParams which takes email, token, password and passwordConfirmation

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).

@mederic-p mederic-p self-assigned this Mar 15, 2019
@ghost ghost added the s2/wip 🚧 This is still being worked on label Mar 15, 2019

For example, if you provide this url: `my-app-scheme-uri://user/reset_password?email={email}&token={token}`, the user will receive a link by email that will look like this: `my-app-scheme-uri://user/reset_password?email=email@example.com&token=XXXXXXXXXXXXXXXXXXXXXX`.
You can then handle the params passed to your application upon launch from this deep link and pass them to the `User.updatePassword` method.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice if we mention the redirectURL prefix need to be supported by eWallet, or else we will get the error The given redirect_url is not allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mederic-p mederic-p added s3/review 👀 This issue is in need of a review and removed s2/wip 🚧 This is still being worked on labels Mar 15, 2019
@mederic-p mederic-p changed the base branch from 117-update-request-consumption to master March 15, 2019 09:41
@mederic-p mederic-p merged commit 0da47db into master Mar 15, 2019
@mederic-p mederic-p deleted the 118-reset-update-password branch March 15, 2019 09:41
@ghost ghost removed the s3/review 👀 This issue is in need of a review label Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants