Skip to content

Commit

Permalink
[nan-661] fix invite flow (#1924)
Browse files Browse the repository at this point in the history
## Describe your changes
Fix few logic errors with the invite flow.

## Issue ticket number and link
NAN-661

## Checklist before requesting a review (skip if just adding/editing
APIs & templates)
- [ ] I added tests, otherwise the reason is: 
- [ ] I added observability, otherwise the reason is:
- [ ] I added analytics, otherwise the reason is:
  • Loading branch information
khaliqgant committed Mar 28, 2024
1 parent 90a2281 commit 8a3e0f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/server/lib/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class AuthController {

const body: InviteAccountBody = req.body as InviteAccountBody;

if (!body || body.accountId !== undefined) {
if (!body || body.accountId === undefined) {
errorManager.errRes(res, 'missing_params');
return;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/server/lib/controllers/user.controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getUserAccountAndEnvironmentFromSession } from '../utils/utils.js';
import type { Request, Response, NextFunction } from 'express';
import EmailClient from '../clients/email.client.js';
import { isCloud, isEnterprise, baseUrl } from '@nangohq/utils/dist/environment/detection.js';
import { isCloud, isEnterprise, basePublicUrl } from '@nangohq/utils/dist/environment/detection.js';
import { errorManager, userService } from '@nangohq/shared';

export interface GetUser {
Expand Down Expand Up @@ -119,7 +119,7 @@ class UserController {
<p>You are invited to join the ${account.name} account on Nango.</p>
<p>Join this account by clicking <a href="${baseUrl}/signup/${invited?.token}">here</a> and completing your signup.</p>
<p>Join this account by clicking <a href="${basePublicUrl}/signup/${invited?.token}">here</a> and completing your signup.</p>
<p>Questions or issues? We are happy to help on the <a href="https://nango.dev/slack">Slack community</a>!</p>
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/src/components/ui/button/Auth/Google.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function GoogleButton({ text, setServerErrorMessage, invitedAccou
}
};

if (invitedAccountID && token) {
if (invitedAccountID !== null && invitedAccountID !== undefined && token) {
postBody.body = JSON.stringify({
accountId: invitedAccountID
});
Expand Down

0 comments on commit 8a3e0f9

Please sign in to comment.