Skip to content

Commit a660a0c

Browse files
authored
fix: Issue #4142 (#4144)
* Tweaks test in order to show the error - Session is effectively created when it should not * Do not create a session when users need verified accounts on signup
1 parent 839a117 commit a660a0c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

spec/ValidationAndPasswordsReset.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ describe("Custom Pages, Email Verification, Password Reset", () => {
258258
user.setUsername("zxcv");
259259
user.set("email", "[email protected]");
260260
user.signUp(null)
261-
.then(() => Parse.User.logIn("zxcv", "asdf"))
261+
.then((user) => {
262+
expect(user.getSessionToken()).toBe(undefined);
263+
return Parse.User.logIn("zxcv", "asdf");
264+
})
262265
.then(() => {
263266
fail('login should have failed');
264267
done();

src/RestWrite.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,11 @@ RestWrite.prototype.createSessionTokenIfNeeded = function() {
548548
if (this.query) {
549549
return;
550550
}
551+
if (!this.storage['authProvider'] // signup call, with
552+
&& this.config.preventLoginWithUnverifiedEmail // no login without verification
553+
&& this.config.verifyUserEmails) { // verification is on
554+
return; // do not create the session token in that case!
555+
}
551556
return this.createSessionToken();
552557
}
553558

0 commit comments

Comments
 (0)