-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implements user invite #3
Conversation
Signed-off-by: Jaipradeesh J <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. One nitpick: Split routing logic for /user/invite
to POST /user/invite
and GET /user/invite/verify
, instead of switching over action
Also, you need to:
|
server/api/v1/users.js
Outdated
/** | ||
* Verifies invite token | ||
*/ | ||
router.post('/invite/verify', requiredFields(['invite_token', 'email']), (req, res, next) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this GET
, not creating anything new here
server/api/v1/users.js
Outdated
* Generates invite token | ||
*/ | ||
router.post('/invite', requiredFields(['user_id', 'email']), (req, res, next) => { | ||
return jwt.createInviteJWT(req.required.user_id, req.required.email, req.app.get('jwtsecret')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are returning a promise. You need to write send out response
instead. See comment
server/api/v1/users.js
Outdated
/** | ||
* Generates invite token | ||
*/ | ||
router.post('/invite', requiredFields(['user_id', 'email']), (req, res, next) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make user_id
camelCase userID
for uniformity.
Signed-off-by: Jaipradeesh J <[email protected]>
Thanks @dolftax. Take a potato. |
After token verification, trigger user creation has to be done from front-end after user fills in username and password.
Say if user b wants to invite user a. user b generates a token for user a with email [email protected] and sends it along. user a makes a call with email [email protected] and a invite token and gets his own email in response. Then show a page for user to set username and password and .. ..