* 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
This commit is contained in:
@@ -258,7 +258,10 @@ describe("Custom Pages, Email Verification, Password Reset", () => {
|
|||||||
user.setUsername("zxcv");
|
user.setUsername("zxcv");
|
||||||
user.set("email", "testInvalidConfig@parse.com");
|
user.set("email", "testInvalidConfig@parse.com");
|
||||||
user.signUp(null)
|
user.signUp(null)
|
||||||
.then(() => Parse.User.logIn("zxcv", "asdf"))
|
.then((user) => {
|
||||||
|
expect(user.getSessionToken()).toBe(undefined);
|
||||||
|
return Parse.User.logIn("zxcv", "asdf");
|
||||||
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
fail('login should have failed');
|
fail('login should have failed');
|
||||||
done();
|
done();
|
||||||
|
|||||||
@@ -548,6 +548,11 @@ RestWrite.prototype.createSessionTokenIfNeeded = function() {
|
|||||||
if (this.query) {
|
if (this.query) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!this.storage['authProvider'] // signup call, with
|
||||||
|
&& this.config.preventLoginWithUnverifiedEmail // no login without verification
|
||||||
|
&& this.config.verifyUserEmails) { // verification is on
|
||||||
|
return; // do not create the session token in that case!
|
||||||
|
}
|
||||||
return this.createSessionToken();
|
return this.createSessionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user