feat: login + TFA authentication
This commit is contained in:
@@ -19,6 +19,22 @@ module.exports = {
|
||||
limit: 1
|
||||
})
|
||||
},
|
||||
login(obj, args, context) {
|
||||
return wiki.db.User.login(args, context).catch(err => {
|
||||
return {
|
||||
succeeded: false,
|
||||
message: err.message
|
||||
}
|
||||
})
|
||||
},
|
||||
loginTFA(obj, args, context) {
|
||||
return wiki.db.User.loginTFA(args, context).catch(err => {
|
||||
return {
|
||||
succeeded: false,
|
||||
message: err.message
|
||||
}
|
||||
})
|
||||
},
|
||||
modifyUser(obj, args) {
|
||||
return wiki.db.User.update({
|
||||
email: args.email,
|
||||
|
@@ -148,8 +148,16 @@ type User implements Base {
|
||||
}
|
||||
|
||||
type OperationResult {
|
||||
succeded: Boolean!
|
||||
succeeded: Boolean!
|
||||
message: String
|
||||
data: String
|
||||
}
|
||||
|
||||
type LoginResult {
|
||||
succeeded: Boolean!
|
||||
message: String
|
||||
tfaRequired: Boolean
|
||||
tfaLoginToken: String
|
||||
}
|
||||
|
||||
# Query (Read)
|
||||
@@ -249,6 +257,17 @@ type Mutation {
|
||||
id: Int!
|
||||
): OperationResult
|
||||
|
||||
login(
|
||||
username: String!
|
||||
password: String!
|
||||
provider: String!
|
||||
): LoginResult
|
||||
|
||||
loginTFA(
|
||||
loginToken: String!
|
||||
securityCode: String!
|
||||
): OperationResult
|
||||
|
||||
modifyComment(
|
||||
id: Int!
|
||||
content: String!
|
||||
|
Reference in New Issue
Block a user