Unintuitive links in invite e-mails
pizkaz opened this issue · comments
PizZaKatZe commented
When inviting users to Greenlight 3 instances, the links which are sent via e-mail lead to the base URL instead of the signup route.
Example:
To sign up, please click the button below and follow the steps.
https://<fqdn>/?inviteToken=i1n56kgP2VB1gx3im6XuVDHb
Expected behavior:
After clicking on the link,
- either (in case OIDC is not configured) Greenlight asks for a username and password to sign me up
- or (in case OIDC is configured) I'm being redirected to the OIDC issuer.
Actual behavior:
I see a landing page (lacking any steps to follow - contrary to what the e-mail says) and have to manually click on
- either (in case OIDC is not configured) "Sign up"
- or (in case OIDC is configured) "Sign in".
This is unintuitive IMHO.
Steps to reproduce:
Invite someone to an existing Greenlight 3 instance.
Things I have tried to mitigate this:
diff --git a/app/controllers/api/v1/admin/invitations_controller.rb b/app/controllers/api/v1/admin/invitations_controller.rb
index 6aab9529..8e0e1a13 100644
--- a/app/controllers/api/v1/admin/invitations_controller.rb
+++ b/app/controllers/api/v1/admin/invitations_controller.rb
@@ -44,10 +44,15 @@ module Api
i.save!
end
+ signup_url = if ENV['OPENID_CONNECT_ISSUER'].present?
+ "#{root_url}signin?inviteToken=#{invitation.token}"
+ else
+ "#{root_url}signup?inviteToken=#{invitation.token}"
+ end
UserMailer.with(
email:,
name: current_user.name,
- signup_url: root_url(inviteToken: invitation.token),
+ signup_url:,
base_url: request.base_url,
provider: current_provider
).invitation_email.deliver_later
The problem with this approach is that it doesn't work when OIDC is configured: Instead of being redirected, I see the signin page. I suspect some kind of react.js magic. 🪄