-
Notifications
You must be signed in to change notification settings - Fork 566
feat: handle undefine username/password for SMTP #2011
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| export default async function getSignature(request) { | ||
| const { userId } = request.params; | ||
| if (!userId) { | ||
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Missing userId parameter.'); | ||
| } | ||
| if (userId !== request.user?.id) { | ||
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.'); | ||
| } | ||
| try { | ||
| const query = new Parse.Query('contracts_Signature'); | ||
| query.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId }); | ||
| const result = await query.first({ useMasterKey: true }); | ||
| return result; | ||
| } catch (err) { | ||
| console.error('Error fetching signature:', err); | ||
| throw err; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||
| export default async function manageSign(request) { | ||||||||||
| const { signature, userId, initials, id, title } = request.params; | ||||||||||
|
|
||||||||||
| if (!userId) { | ||||||||||
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Missing userId parameter.'); | ||||||||||
| } | ||||||||||
| if (userId !== request.user?.id) { | ||||||||||
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.'); | ||||||||||
|
||||||||||
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.'); | |
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'You can only save signatures for yourself.'); |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition 'if (userPtr)' is unnecessary because userPtr is defined unconditionally on line 10. Since userId is already validated to be non-null on lines 4-6, userPtr will always exist. This check should be removed and 'UserId' should always be set.
| if (userPtr) { | |
| signatureCls.set('UserId', userPtr); | |
| } | |
| signatureCls.set('UserId', userPtr); |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||||||
| export default async function saveSignature(request) { | ||||||||||
| const { signature, userId, initials, id, title } = request.params; | ||||||||||
|
|
||||||||||
| if (!userId) { | ||||||||||
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Missing userId parameter.'); | ||||||||||
| } | ||||||||||
| if (userId !== request.user?.id) { | ||||||||||
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.'); | ||||||||||
|
||||||||||
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.'); | |
| throw new Parse.Error(Parse.Error.INVALID_QUERY, 'You can only save signatures for yourself.'); |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition 'if (userPtr)' is unnecessary because userPtr is defined unconditionally on line 10. Since userId is already validated to be non-null on lines 4-6, userPtr will always exist. This check should be removed and 'UserId' should always be set.
| if (userPtr) { | |
| signatureCls.set('UserId', userPtr); | |
| } | |
| signatureCls.set('UserId', userPtr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message 'Cannot save signature for the current user' is incorrect for a get operation. This function retrieves signatures, not saves them. The message should be 'Cannot retrieve signature for another user.' or 'You can only retrieve your own signatures.'