mirror of
https://github.com/PretendoNetwork/account.git
synced 2026-04-26 16:17:31 -05:00
Only store Discord user ID
This commit is contained in:
parent
da9b2f66fe
commit
0caa1b9b66
|
|
@ -183,7 +183,7 @@ async function addUserConnection(pnid, data, type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addUserConnectionDiscord(pnid, data) {
|
async function addUserConnectionDiscord(pnid, data) {
|
||||||
if (!data.id || !data.access_token || !data.refresh_token) {
|
if (!data.id) {
|
||||||
return {
|
return {
|
||||||
app: 'api',
|
app: 'api',
|
||||||
status: 400,
|
status: 400,
|
||||||
|
|
@ -213,9 +213,7 @@ async function removeUserConnection(pnid, type) {
|
||||||
async function removeUserConnectionDiscord(pnid) {
|
async function removeUserConnectionDiscord(pnid) {
|
||||||
await PNID.updateOne({ pid: pnid.get('pid') }, {
|
await PNID.updateOne({ pid: pnid.get('pid') }, {
|
||||||
$set: {
|
$set: {
|
||||||
'connections.discord.id': '',
|
'connections.discord.id': ''
|
||||||
'connections.discord.access_token': '',
|
|
||||||
'connections.discord.refresh_token': ''
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,7 @@ const PNIDSchema = new Schema({
|
||||||
},
|
},
|
||||||
connections: {
|
connections: {
|
||||||
discord: {
|
discord: {
|
||||||
id: String,
|
id: String
|
||||||
access_token: String,
|
|
||||||
refresh_token: String,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
const { PNID } = require('./models/pnid');
|
const { PNID } = require('../../../../models/pnid');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [GET]
|
* [GET]
|
||||||
|
|
@ -43,9 +43,7 @@ router.get('/', async (request, response) => {
|
||||||
},
|
},
|
||||||
connections: {
|
connections: {
|
||||||
discord: {
|
discord: {
|
||||||
id: pnid.get('connections.discord.id'),
|
id: pnid.get('connections.discord.id')
|
||||||
access_token: pnid.get('connections.discord.access_token'),
|
|
||||||
refresh_token: pnid.get('connections.discord.refresh_token'),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -99,9 +97,7 @@ router.post('/', async (request, response) => {
|
||||||
},
|
},
|
||||||
connections: {
|
connections: {
|
||||||
discord: {
|
discord: {
|
||||||
id: pnid.get('connections.discord.id'),
|
id: pnid.get('connections.discord.id')
|
||||||
access_token: pnid.get('connections.discord.access_token'),
|
|
||||||
refresh_token: pnid.get('connections.discord.refresh_token'),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user