Renamed login middleware to getIdentityToken

no-issue

This name `login` was misleading as this middleware didn't login
members, that was handled by the `authentication` middleware,
specifically `exchangeTokenForSession`
This commit is contained in:
Fabien O'Carroll 2019-11-26 17:44:25 +02:00
parent 419e12d90a
commit 046bd652e5
2 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@ const shared = require('../../web/shared');
const labsService = require('../labs');
const membersService = require('./index');
const login = async function (req, res) {
const getIdentityToken = async function (req, res) {
try {
const token = await membersService.ssr.getIdentityTokenForMemberFromSession(req, res);
res.writeHead(200);
@ -82,9 +82,9 @@ module.exports = {
exchangeTokenForSession,
decorateResponse
],
login: [
getIdentityToken: [
shared.middlewares.labs.members,
login
getIdentityToken
],
logout: [
shared.middlewares.labs.members,

View File

@ -119,7 +119,7 @@ module.exports = function setupSiteApp(options = {}) {
// Members middleware
// Initializes members specific routes as well as assigns members specific data to the req/res objects
siteApp.get('/members/ssr', membersMiddleware.login);
siteApp.get('/members/ssr', membersMiddleware.getIdentityToken);
siteApp.delete('/members/ssr', membersMiddleware.logout);
siteApp.post('/members/webhooks/stripe', membersMiddleware.stripeWebhooks);