Back

Get team membership invitation to ask user confirmation to join the team

  • 0
  • Teams
Richard Trudel
17 Mar, 2023, 15:20

Hi, I try to build a confirmation dialog for new invited users. After they click the invitation link in the e-mail, I would like to show a confirmation box with this :

{inviterName} invited you to {teamName}. Do you accept?

But the Teams API do not allow me to fetch the pending membership for obvious security reasons. Is there a way to achieve this by using another API? Else, I can bypass this step, as the email do the same, but on a UX perspective, I think it could be good to have this confirmation inside the app.

Thank you.

TL;DR
The user is asking if there is a way to prevent a user from automatically logging in once an invitation is accepted. They also ask about the passwordUpdate attribute for a user without a password. The response suggests using an Appwrite Function to handle these cases. The user also asks if the inviter's name is available in the pending invitation database table. The response suggests using "Someone invited you to {teamName}" as the email message. There is no solution provided for fetching pending memberships or showing a confirmation box within the app.
Richard Trudel
17 Mar, 2023, 15:23

I guess the inviter name is not available either. I can also use Someone invited you to {teamName}. But as the email can show the inviter's name, I guess it's living somewhere in a pending invitation database table?

Richard Trudel
17 Mar, 2023, 15:54

Also, new users after accepting invitation are automatically logged in, without being prompted to set a new password. I guess I can work around it by redirecting the user to the set password process, but if we could retrieve the invitation, I guess we would receive also if the user is already existing or not, so I could prompt for new password along the invitation acceptance...

Not sure it's all clear, but I can clarify if required of course.

Drake
17 Mar, 2023, 17:46

The only way would be to use an Appwrite Function.

Drake
17 Mar, 2023, 17:47

when the api call to invite the user is called, the email is prepared and then queued: https://github.com/appwrite/appwrite/blob/e8c74d7204258133a61db09ed518211170e751d9/app/controllers/api/teams.php#L447-L463

Drake
17 Mar, 2023, 17:51

What's the passwordUpdate attribute on the result of account.get() for a user without a password? 🧐

Richard Trudel
17 Mar, 2023, 18:01

Thank you, I was trying to avoid functions for that particuliar case, but it may be simple after all 🙂

Richard Trudel
17 Mar, 2023, 18:02

I understand for the email, that means the inviter's name (or reference to it) is not stored anywhre so I can't rely on it.

Richard Trudel
17 Mar, 2023, 18:04

Of course I can wait after the invitation is accepted to redirect to the set password form, or I can make my same function of above to query the userId to know if it's a user without a password and show the set password form along the invitation acceptance, I guess...

Richard Trudel
17 Mar, 2023, 18:06

But, another question in the same topic which can helps to find the best flow for my specific case, there is a way to prevent a user from being automatically logged in once an invitation is accepted?

Drake
17 Mar, 2023, 18:28

not really because that's how the API works

Drake
17 Mar, 2023, 18:29

and if you don't, they wouldn't be able to do anything 🧐

Richard Trudel
17 Mar, 2023, 19:14

Ok, I understand, thanks.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more