Skip to content
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

Update raw link in invite email to be parsec:// and not redirect link #8625

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions server/parsec/components/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def generate_invite_email(
greeter_name: str | None, # None for device invitation
organization_id: OrganizationID,
invitation_url: str,
raw_invitation_url: str,
server_url: str,
) -> Message:
# Quick fix to have a similar behavior between Rust and Python
Expand All @@ -92,6 +93,7 @@ def generate_invite_email(
greeter=greeter_name,
organization_id=organization_id.str,
invitation_url=invitation_url,
raw_invitation_url=raw_invitation_url,
server_url=server_url,
)
text = get_template("invitation_mail.txt").render(
Expand Down Expand Up @@ -535,12 +537,15 @@ async def _send_user_invitation_email(
if not self._config.server_addr:
return SendEmailBadOutcome.BAD_SMTP_CONFIG

invitation_url = ParsecInvitationAddr.build(
invitation_addr = ParsecInvitationAddr.build(
server_addr=self._config.server_addr,
organization_id=organization_id,
invitation_type=InvitationType.USER,
token=token,
).to_http_redirection_url()
)

invitation_url = invitation_addr.to_http_redirection_url()
raw_invitation_url = invitation_addr.to_url()

message = generate_invite_email(
from_addr=self._config.email_config.sender,
Expand All @@ -549,6 +554,7 @@ async def _send_user_invitation_email(
reply_to=greeter_human_handle.email,
organization_id=organization_id,
invitation_url=invitation_url,
raw_invitation_url=raw_invitation_url,
server_url=self._config.server_addr.to_http_url(),
)

Expand All @@ -568,12 +574,15 @@ async def _send_device_invitation_email(
if not self._config.server_addr:
return SendEmailBadOutcome.BAD_SMTP_CONFIG

invitation_url = ParsecInvitationAddr.build(
invitation_addr = ParsecInvitationAddr.build(
server_addr=self._config.server_addr,
organization_id=organization_id,
invitation_type=InvitationType.DEVICE,
token=token,
).to_http_redirection_url()
)

invitation_url = invitation_addr.to_http_redirection_url()
raw_invitation_url = invitation_addr.to_url()

message = generate_invite_email(
from_addr=self._config.email_config.sender,
Expand All @@ -582,6 +591,7 @@ async def _send_device_invitation_email(
reply_to=None,
organization_id=organization_id,
invitation_url=invitation_url,
raw_invitation_url=raw_invitation_url,
server_url=self._config.server_addr.to_http_url(),
)

Expand Down
2 changes: 1 addition & 1 deletion server/parsec/templates/invitation_mail.html
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
The button didn't work? You can copy/paste the following link in your browser instead:
</em>
<em class="grey-text-url">
{{ invitation_url }}
{{ raw_invitation_url }}
</em>
</div>
<p>
Expand Down