Skip to content

Commit

Permalink
N21-1269 fixes /username/:pseudonym
Browse files Browse the repository at this point in the history
  • Loading branch information
arnegns committed Sep 20, 2023
1 parent f9a77ba commit dc21757
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions controllers/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,20 @@ router.post('/consent', auth.authChecker, (r, w) => acceptConsent(r, w, r.query.

router.get('/username/:pseudonym', (req, res, next) => {
if (req.cookies.jwt) {
let apiPromise;
if (Configuration.get('FEATURE_CTL_TOOLS_TAB_ENABLED')) {
const apiv3res = api(req, { version: 'v3' })
.get(`/pseudonyms/${req.params.pseudonym}`);
res = {
data: [apiv3res],
};
apiPromise = api(req, { version: 'v3' })
.get(`/pseudonyms/${req.params.pseudonym}`)
.then((response) => ({ data: [response] }));
} else {
res = api(req)
.get('/pseudonym', {
qs: {
pseudonym: req.params.pseudonym,
},
});
apiPromise = api(req).get('/pseudonym', {
qs: {
pseudonym: req.params.pseudonym,
},
});
}
res.then((pseudonym) => {

apiPromise.then((pseudonym) => {
let shortName;
let completeName;
const anonymousName = '???';
Expand All @@ -164,15 +163,15 @@ router.get('/username/:pseudonym', (req, res, next) => {
shortTitle: res.locals.theme.short_title,
}),
});
})
.catch(next);
}).catch(next);
} else {
return res.render('oauth2/username', {
depseudonymized: false,
completeName: res.$t('login.oauth2.label.showName'),
shortName: res.$t('login.oauth2.label.showName'),
infoText: '',
});
}
return res.render('oauth2/username', {
depseudonymized: false,
completeName: res.$t('login.oauth2.label.showName'),
shortName: res.$t('login.oauth2.label.showName'),
infoText: '',
});
});

module.exports = router;

0 comments on commit dc21757

Please sign in to comment.