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 accountID to the set password link #1857

Merged
merged 29 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
21a8d88
Add email to the set password link
jasperhuangg Mar 18, 2021
e89635c
fix js style
jasperhuangg Mar 18, 2021
55cc702
fix js style
jasperhuangg Mar 18, 2021
4e4b83e
fix js style
jasperhuangg Mar 18, 2021
f96fd91
fix js style
jasperhuangg Mar 18, 2021
0c0d616
Update Session.js
jasperhuangg Mar 18, 2021
6502af7
Update Session.js
jasperhuangg Mar 18, 2021
b22f510
Add reasonable default
jasperhuangg Mar 18, 2021
c9b4933
Merge branch 'jasper-setPasswordEmailLink' of github.com:Expensify/Ex…
jasperhuangg Mar 18, 2021
e9cec36
fix JSDoc
jasperhuangg Mar 18, 2021
398bbe5
fix JSDoc
jasperhuangg Mar 18, 2021
5430cf0
remove unused defaults
jasperhuangg Mar 22, 2021
bb7be20
reroute resend validate code to SetCashPassword command
jasperhuangg Mar 23, 2021
82b5465
remove incorrect destructuring usage
jasperhuangg Mar 23, 2021
b2b00ab
Merge branch 'master' into jasper-setPasswordEmailLink
jasperhuangg Mar 23, 2021
a6e5721
Change API command back to ResendValidateCode
jasperhuangg Mar 24, 2021
daa2fec
Simplify call to createTemporaryLogin
jasperhuangg Mar 24, 2021
8c343b4
Merge branch 'master' of github.com:Expensify/Expensify.cash into jas…
jasperhuangg Mar 24, 2021
a72a6c5
Change SetPassword to use accountID instead of email (to keep consist…
jasperhuangg Mar 26, 2021
251d7e3
Change SetPassword to also include email if provided.
jasperhuangg Mar 26, 2021
b3c2f5c
Change SetPassword to also include email if provided.
jasperhuangg Mar 26, 2021
1c2977b
Change SetPassword to also include email if provided.
jasperhuangg Mar 26, 2021
25b6b8a
Change SetPassword to also include email if provided.
jasperhuangg Mar 26, 2021
4f97d57
Update JSDoc for SetPassword, make accountID optional
jasperhuangg Mar 29, 2021
2f012b7
Remove email parameter from SetPassword, make accountID a required pa…
jasperhuangg Mar 31, 2021
c86b93d
Remove unused routes
jasperhuangg Apr 6, 2021
775439a
Update src/libs/API.js
jasperhuangg Apr 7, 2021
4ee6e0e
Add inline comments
jasperhuangg Apr 7, 2021
1ba8ca8
Merge remote-tracking branch 'origin/jasper-setPasswordEmailLink' int…
jasperhuangg Apr 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default {
IOU_BILL: 'iou/split',
SEARCH: 'search',
SIGNIN: 'signin',
SET_PASSWORD_WITH_VALIDATE_CODE: 'setpassword/:validateCode',
SET_PASSWORD_WITH_VALIDATE_CODE: 'setpassword/:accountID/:validateCode',
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
PROFILE: 'profile',
PROFILE_WITH_LOGIN: 'profile/:login',
getProfileRoute: login => `profile/${login}`,
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
DETAILS: 'details',
DETAILS_WITH_LOGIN: 'details/:login',
getDetailsRoute: login => `details/${login}`,
Expand Down
5 changes: 3 additions & 2 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ function Report_UpdateLastRead(parameters) {

/**
* @param {Object} parameters
* @param {Number} parameters.email
* @param {String} parameters.email
* @returns {Promise}
*/
function ResendValidateCode(parameters) {
Expand All @@ -543,11 +543,12 @@ function ResendValidateCode(parameters) {
* @param {Object} parameters
* @param {String} parameters.password
* @param {String} parameters.validateCode
* @param {String} parameters.accountID
* @returns {Promise}
*/
function SetPassword(parameters) {
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
const commandName = 'SetPassword';
requireParameters(['email', 'password', 'validateCode'], parameters, commandName);
requireParameters(['accountID, password', 'validateCode'], parameters, commandName);
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
return Network.post(commandName, parameters);
}

Expand Down
8 changes: 4 additions & 4 deletions src/libs/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,19 @@ function restartSignin() {
*
* @param {String} password
* @param {String} validateCode
* @param {String} accountID
*/
function setPassword(password, validateCode) {
function setPassword(password, validateCode, accountID) {
Onyx.merge(ONYXKEYS.ACCOUNT, {error: '', loading: true});

API.SetPassword({
email: credentials.login,
password,
validateCode,
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
accountID,
})
.then((response) => {
if (response.jsonCode === 200) {
const {authToken, email} = response;
createTemporaryLogin(authToken, email);
createTemporaryLogin(response.authToken, response.email);
return;
}

Expand Down
7 changes: 6 additions & 1 deletion src/pages/SetPasswordPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const propTypes = {

route: PropTypes.shape({
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
params: PropTypes.shape({
accountID: PropTypes.string,
validateCode: PropTypes.string,
}),
}),
Expand Down Expand Up @@ -78,7 +79,11 @@ class SetPasswordPage extends Component {
this.setState({
formError: null,
});
setPassword(this.state.password, lodashGet(this.props.route, 'params.validateCode', ''));
setPassword(
this.state.password,
lodashGet(this.props.route, 'params.validateCode', ''),
lodashGet(this.props.route, 'params.accountID', ''),
);
}

render() {
Expand Down