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
[NEW] Service account one-tap login #7
Conversation
…ajaditya/Rocket.Chat into service-account-login
…Rocket.Chat into service-account-login
@@ -20,6 +20,7 @@ export class Users extends Base { | |||
this.tryEnsureIndex({ type: 1 }); | |||
this.tryEnsureIndex({ 'visitorEmails.address': 1 }); | |||
this.tryEnsureIndex({ federation: 1 }, { sparse: true }); | |||
this.tryEnsureIndex({ 'u._id': 1 }); |
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.
Good
if (Meteor.user().u) { | ||
username = Meteor.user().u.username; | ||
} | ||
console.log(username); |
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.
Remove the log statement. Isn't the lint test supposed to give error on log statements?
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.
Yes, it should, I will update this.
import { Users } from '../../../models'; | ||
|
||
Meteor.methods({ | ||
getLoginToken(username) { |
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.
What about the case when the user corresponding to neither Meteor.userId
and nor username
has a .u
property?
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.
Ohh yes, I need to throw an error for that.
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.
Due to high security concerns in this method, I'd recommend structuring it like.. for the case we want to return, generate and return.. for everything else raise Error
This pull request needs to be reviewed after the callbacks one.