Implement remote account resolution

This commit is contained in:
Akihiko Odaki 2018-03-27 16:51:12 +09:00
parent bee892d446
commit 68ce6d5748
73 changed files with 735 additions and 334 deletions

View file

@ -39,6 +39,7 @@ module.exports = (app: express.Application) => {
if (userToken == null) return res.send('plz signin');
const user = await User.findOneAndUpdate({
host: null,
'account.token': userToken
}, {
$set: {
@ -126,6 +127,7 @@ module.exports = (app: express.Application) => {
const result = await twAuth.done(JSON.parse(ctx), req.query.oauth_verifier);
const user = await User.findOne({
host: null,
'account.twitter.user_id': result.userId
});
@ -148,6 +150,7 @@ module.exports = (app: express.Application) => {
const result = await twAuth.done(JSON.parse(ctx), verifier);
const user = await User.findOneAndUpdate({
host: null,
'account.token': userToken
}, {
$set: {