Skip to content

Commit c38a4a9

Browse files
committed
Revert "tests"
This reverts commit 407825d.
1 parent 0c49a4a commit c38a4a9

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

spec/PagesRouter.spec.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,13 @@ describe('Pages Router', () => {
658658
const appId = linkResponse.headers['x-parse-page-param-appid'];
659659
const token = linkResponse.headers['x-parse-page-param-token'];
660660
const locale = linkResponse.headers['x-parse-page-param-locale'];
661+
const username = linkResponse.headers['x-parse-page-param-username'];
661662
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
662663
const passwordResetPagePath = pageResponse.calls.all()[0].args[0];
663664
expect(appId).toBeDefined();
664665
expect(token).toBeDefined();
665666
expect(locale).toBeDefined();
667+
expect(username).toBeDefined();
666668
expect(publicServerUrl).toBeDefined();
667669
expect(passwordResetPagePath).toMatch(
668670
new RegExp(`\/${exampleLocale}\/${pages.passwordReset.defaultFile}`)
@@ -676,6 +678,7 @@ describe('Pages Router', () => {
676678
body: {
677679
token,
678680
locale,
681+
username,
679682
new_password: 'newPassword',
680683
},
681684
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
@@ -770,13 +773,15 @@ describe('Pages Router', () => {
770773

771774
const appId = linkResponse.headers['x-parse-page-param-appid'];
772775
const locale = linkResponse.headers['x-parse-page-param-locale'];
776+
const username = linkResponse.headers['x-parse-page-param-username'];
773777
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
774778
const invalidVerificationPagePath = pageResponse.calls.all()[0].args[0];
775779
expect(appId).toBeDefined();
776780
expect(locale).toBe(exampleLocale);
781+
expect(username).toBeDefined();
777782
expect(publicServerUrl).toBeDefined();
778783
expect(invalidVerificationPagePath).toMatch(
779-
new RegExp(`\/${exampleLocale}\/${pages.emailVerificationLinkInvalid.defaultFile}`)
784+
new RegExp(`\/${exampleLocale}\/${pages.emailVerificationLinkExpired.defaultFile}`)
780785
);
781786

782787
const formUrl = `${publicServerUrl}/apps/${appId}/resend_verification_email`;
@@ -785,7 +790,7 @@ describe('Pages Router', () => {
785790
method: 'POST',
786791
body: {
787792
locale,
788-
username: 'exampleUsername',
793+
username,
789794
},
790795
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
791796
followRedirects: false,
@@ -821,13 +826,15 @@ describe('Pages Router', () => {
821826

822827
const appId = linkResponse.headers['x-parse-page-param-appid'];
823828
const locale = linkResponse.headers['x-parse-page-param-locale'];
829+
const username = linkResponse.headers['x-parse-page-param-username'];
824830
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
825831
const invalidVerificationPagePath = pageResponse.calls.all()[0].args[0];
826832
expect(appId).toBeDefined();
827833
expect(locale).toBe(exampleLocale);
834+
expect(username).toBeDefined();
828835
expect(publicServerUrl).toBeDefined();
829836
expect(invalidVerificationPagePath).toMatch(
830-
new RegExp(`\/${exampleLocale}\/${pages.emailVerificationLinkInvalid.defaultFile}`)
837+
new RegExp(`\/${exampleLocale}\/${pages.emailVerificationLinkExpired.defaultFile}`)
831838
);
832839

833840
spyOn(UserController.prototype, 'resendVerificationEmail').and.callFake(() =>
@@ -840,7 +847,7 @@ describe('Pages Router', () => {
840847
method: 'POST',
841848
body: {
842849
locale,
843-
username: 'exampleUsername',
850+
username,
844851
},
845852
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
846853
followRedirects: false,
@@ -1125,10 +1132,12 @@ describe('Pages Router', () => {
11251132

11261133
const appId = linkResponse.headers['x-parse-page-param-appid'];
11271134
const token = linkResponse.headers['x-parse-page-param-token'];
1135+
const username = linkResponse.headers['x-parse-page-param-username'];
11281136
const publicServerUrl = linkResponse.headers['x-parse-page-param-publicserverurl'];
11291137
const passwordResetPagePath = pageResponse.calls.all()[0].args[0];
11301138
expect(appId).toBeDefined();
11311139
expect(token).toBeDefined();
1140+
expect(username).toBeDefined();
11321141
expect(publicServerUrl).toBeDefined();
11331142
expect(passwordResetPagePath).toMatch(new RegExp(`\/${pages.passwordReset.defaultFile}`));
11341143
pageResponse.calls.reset();
@@ -1139,6 +1148,7 @@ describe('Pages Router', () => {
11391148
method: 'POST',
11401149
body: {
11411150
token,
1151+
username,
11421152
new_password: 'newPassword',
11431153
},
11441154
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },

spec/ParseLiveQuery.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ describe('ParseLiveQuery', function () {
10371037
const userController = new UserController(emailAdapter, 'test', {
10381038
verifyUserEmails: true,
10391039
});
1040-
userController.verifyEmail(foundUser._email_verify_token);
1040+
userController.verifyEmail(foundUser.username, foundUser._email_verify_token);
10411041
});
10421042
});
10431043
});

src/Controllers/UserController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class UserController extends AdaptableController {
7171
}
7272
const maintenanceAuth = Auth.maintenance(this.config);
7373
const result = await new RestQuery(this.config, maintenanceAuth, '_User', query).execute();
74-
if (result.results.length) {
74+
if (result.results.length && result.results[0].emailVerified) {
7575
query.objectId = result.results[0].objectId;
7676
}
7777
return await rest.update(this.config, maintenanceAuth, '_User', query, updateFields);

src/Routers/PagesRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class PagesRouter extends PromiseRouter {
100100
return this.goToPage(req, pages.emailVerificationSuccess);
101101
},
102102
() => {
103-
return this.goToPage(req, pages.emailVerificationLinkInvalid);
103+
return this.goToPage(req, pages.emailVerificationLinkExpired);
104104
}
105105
);
106106
}

0 commit comments

Comments
 (0)