forked from parse-community/parse-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove hidden properties in handleLogin & handleMe (parse-community#4335
- Loading branch information
1 parent
cdf9b2e
commit 759aace
Showing
2 changed files
with
87 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3038,7 +3038,7 @@ describe('Parse.User testing', () => { | |
}); | ||
}); | ||
|
||
it('should not retrieve hidden fields', done => { | ||
it('should not retrieve hidden fields on GET users/me (#3432)', done => { | ||
|
||
var emailAdapter = { | ||
sendVerificationEmail: () => {}, | ||
|
@@ -3073,6 +3073,34 @@ describe('Parse.User testing', () => { | |
expect(res.emailVerified).toBe(false); | ||
expect(res._email_verify_token).toBeUndefined(); | ||
done() | ||
}).catch((err) => { | ||
fail(JSON.stringify(err)); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should not retrieve hidden fields on GET users/id (#3432)', done => { | ||
|
||
var emailAdapter = { | ||
sendVerificationEmail: () => {}, | ||
sendPasswordResetEmail: () => Promise.resolve(), | ||
sendMail: () => Promise.resolve() | ||
} | ||
|
||
const user = new Parse.User(); | ||
user.set({ | ||
username: 'hello', | ||
password: 'world', | ||
email: "[email protected]" | ||
}) | ||
|
||
reconfigureServer({ | ||
appName: 'unused', | ||
verifyUserEmails: true, | ||
emailAdapter: emailAdapter, | ||
publicServerURL: "http://localhost:8378/1" | ||
}).then(() => { | ||
return user.signUp(); | ||
}).then(() => rp({ | ||
method: 'GET', | ||
url: 'http://localhost:8378/1/users/' + Parse.User.current().id, | ||
|
@@ -3091,6 +3119,45 @@ describe('Parse.User testing', () => { | |
}); | ||
}); | ||
|
||
it('should not retrieve hidden fields on login (#3432)', done => { | ||
|
||
var emailAdapter = { | ||
sendVerificationEmail: () => {}, | ||
sendPasswordResetEmail: () => Promise.resolve(), | ||
sendMail: () => Promise.resolve() | ||
} | ||
|
||
const user = new Parse.User(); | ||
user.set({ | ||
username: 'hello', | ||
password: 'world', | ||
email: "[email protected]" | ||
}) | ||
|
||
reconfigureServer({ | ||
appName: 'unused', | ||
verifyUserEmails: true, | ||
emailAdapter: emailAdapter, | ||
publicServerURL: "http://localhost:8378/1" | ||
}).then(() => { | ||
return user.signUp(); | ||
}).then(() => rp.get({ | ||
url: 'http://localhost:8378/1/[email protected]&username=hello&password=world', | ||
json: true, | ||
headers: { | ||
'X-Parse-Application-Id': Parse.applicationId, | ||
'X-Parse-REST-API-Key': 'rest' | ||
}, | ||
})).then((res) => { | ||
expect(res.emailVerified).toBe(false); | ||
expect(res._email_verify_token).toBeUndefined(); | ||
done(); | ||
}).catch((err) => { | ||
fail(JSON.stringify(err)); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should not allow updates to hidden fields', done => { | ||
var emailAdapter = { | ||
sendVerificationEmail: () => {}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters