Skip to content

Commit 282dde0

Browse files
committed
add check before sending
1 parent 3bb8d3e commit 282dde0

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/auth.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,18 @@ function registerOauth() {
126126
})
127127
}
128128

129+
let handled
129130
if (req.hostname !== redirectURL.hostname) {
130-
await handleServiceUrl(req, res)
131+
handled = await handleServiceUrl(req, res)
131132
}
132133

133134
if (!req.isAuthenticated()) {
134135
return res.redirect("/auth")
135136
}
136137

137-
next()
138+
if (!handled) {
139+
next()
140+
}
138141
})
139142

140143
router.get("/auth", passport.authenticate("oauth2"))
@@ -163,9 +166,11 @@ function registerFakeAuth() {
163166
})
164167
}
165168

166-
await handleServiceUrl(req, res)
169+
const handled = await handleServiceUrl(req, res)
167170

168-
next()
171+
if (!handled) {
172+
next()
173+
}
169174
})
170175

171176
router.get("/auth", (req, res) => {

0 commit comments

Comments
 (0)