Skip to content

Commit

Permalink
correction redirection (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
hichri-louay authored Feb 12, 2024
2 parents f1e656e + e7efea6 commit a95449b
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 127 deletions.
24 changes: 9 additions & 15 deletions middleware/passport.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,16 +778,12 @@ exports.addTwitterChannel = async (req, res) => {
} = await userAuth.get('account/verify_credentials', {
include_email: true,
})

const env = req.query.r.includes('frontendApp=metamask')
? process.env.METAMASK_BASED_URL
: process.env.BASED_URL
if (await TwitterProfile.exists({ UserId: user_id, twitter_id: id })) {
return res.redirect(
req.query.state.includes('frontendApp=metamask')
? process.env.METAMASK_BASED_URL
: process.env.BASED_URL +
redirect +
'?message=' +
'account exist' +
'&sn=twitter'
env + redirect + '?message=' + 'account exist' + '&sn=twitter'
)
} else {
let profile = { _json: {} }
Expand All @@ -805,13 +801,11 @@ exports.addTwitterChannel = async (req, res) => {
}
// return cb(null, { id: user_id })
res.redirect(
req.query.state.includes('frontendApp=metamask')
? process.env.METAMASK_BASED_URL
: process.env.BASED_URL +
redirect +
'?message=' +
'account_linked_with_success' +
'&sn=twitter'
env +
redirect +
'?message=' +
'account_linked_with_success' +
'&sn=twitter'
)
}
/*
Expand Down
Loading

0 comments on commit a95449b

Please sign in to comment.