-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add method to check the status of the token #34
base: master
Are you sure you want to change the base?
Changes from 2 commits
4fd7cb0
96933cf
2d6e947
2d1b340
1db4d53
926184b
6f78e4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default function (options) { | ||
const queries = [] | ||
|
||
queries.push(` | ||
type Query { | ||
# Returns true if token is valid | ||
checkToken(token: String!): SuccessResponse | ||
}`) | ||
|
||
return queries | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {Accounts} from 'meteor/accounts-base' | ||
import {Meteor} from 'meteor/meteor' | ||
|
||
export default async function (root, { token }, {userId}) { | ||
const user = Meteor.users.findOne({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's faster to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both might be appropriate (IMO), There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So in this case it'll be faster, you're right. |
||
_id: userId, | ||
'services.resume.loginTokens.hashedToken' : Accounts._hashLoginToken(token) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget to check the date |
||
}); | ||
return { | ||
success: !!user | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import checkToken from './checkToken' | ||
|
||
const resolvers = { | ||
checkToken | ||
} | ||
|
||
export default function (options) { | ||
return { Query: resolvers } | ||
} |
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.
We still need to delete this mutation