admin管理员组

文章数量:1316408

My application supports normal registration for admin roles and registration by invite for team members. Admins can successfully register themselves. Login functionality is also working fine. I am using jwt for token generation and AuthGuards to protect private routes.

Need some help on how I can send an invitation url to users? (nodemailer already configured and working). More concerned about url generation.

Can someone help me? The application backend is in nestjs and frontend is in angular 8. Currently I am testing apis through postman.

Thanks in advance, Ajinkya

My application supports normal registration for admin roles and registration by invite for team members. Admins can successfully register themselves. Login functionality is also working fine. I am using jwt for token generation and AuthGuards to protect private routes.

Need some help on how I can send an invitation url to users? (nodemailer already configured and working). More concerned about url generation.

Can someone help me? The application backend is in nestjs and frontend is in angular 8. Currently I am testing apis through postman.

Thanks in advance, Ajinkya

Share Improve this question edited Jul 22, 2019 at 10:43 Kim Kern 60.6k20 gold badges217 silver badges214 bronze badges asked Jul 22, 2019 at 9:38 Ajinkya GanooAjinkya Ganoo 1652 silver badges12 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

1) Create a database entity invitation-token with one column token (randomly generated UUID, e.g. with this uuid lib). Set it to self-delete entries after 24 hours. (e.g. TTL in mongodb)

2) Create an endpoint that allows registration with a query param invitation-token,
e.g. /registration?invitation-token=Usa67Nsus78. It only allows registration if the given token exists in the table created in step 1).

3) Create an invite endpoint that takes a mail address as input. It creates a new token in the invitation-token table and sends an email to the given address with a link to the endpoint in 2)

本文标签: javascriptHow can we implement a registration by invitation in existing applicationStack Overflow