Skip to content

Commit 5f1f59b

Browse files
abelanger5grutt
andauthored
fix: onboarding redirect and expired link bugs (#286)
Co-authored-by: Gabe Ruttner <[email protected]>
1 parent 1dccc38 commit 5f1f59b

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

frontend/app/src/pages/authenticated.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const invitesRedirector = async (currentUrl: string) => {
4848

4949
const invites = res.data.rows || [];
5050

51-
if (invites.length > 0 && !currentUrl.includes('/onboarding')) {
51+
if (invites.length > 0 && !currentUrl.includes('/onboarding/invites')) {
5252
throw redirect('/onboarding/invites');
5353
}
5454

internal/repository/prisma/tenant_invite.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func (r *tenantInviteRepository) ListTenantInvitesByEmail(email string) ([]db.Te
4545
return r.client.TenantInviteLink.FindMany(
4646
db.TenantInviteLink.InviteeEmail.Equals(email),
4747
db.TenantInviteLink.Status.Equals(db.InviteLinkStatusPending),
48+
db.TenantInviteLink.Expires.Gt(time.Now()),
4849
).With(
4950
db.TenantInviteLink.Tenant.Fetch(),
5051
).Exec(context.Background())

internal/repository/tenant_invite.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ type TenantInviteRepository interface {
4242
// GetTenantInvite returns the tenant invite with the given id
4343
GetTenantInvite(id string) (*db.TenantInviteLinkModel, error)
4444

45-
// ListTenantInvitesByEmail returns the list of tenant invites for the given invitee email
45+
// ListTenantInvitesByEmail returns the list of tenant invites for the given invitee email for invites
46+
// which are not expired
4647
ListTenantInvitesByEmail(email string) ([]db.TenantInviteLinkModel, error)
4748

4849
// ListTenantInvitesByTenantId returns the list of tenant invites for the given tenant id

0 commit comments

Comments
 (0)