Browse Source

server: Fixed redirect loop on auth internal failure.

1.0 1.0.2
Gisle Aune 6 years ago
parent
commit
346bd7f70c
  1. 2
      package.json
  2. 6
      routes/auth.js

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "@gisle/rpdata-frontend", "name": "@gisle/rpdata-frontend",
"version": "1.0.1",
"version": "1.0.2",
"description": "RPData (www.aiterp.net) frontend/proxy", "description": "RPData (www.aiterp.net) frontend/proxy",
"main": "./index.js", "main": "./index.js",
"scripts": { "scripts": {

6
routes/auth.js

@ -17,7 +17,11 @@ router.get("/login", saveReferer, passport.authenticate("auth0", {scope: "openid
res.redirect("/") res.redirect("/")
}) })
router.get("/callback", passport.authenticate("auth0", { failureRedirect: "/auth/login" }), (req, res) => {
router.get("/error", (req, res) => {
res.render("Login error")
})
router.get("/callback", passport.authenticate("auth0", { failureRedirect: "/auth/error" }), (req, res) => {
if (req.user == null) { if (req.user == null) {
throw new Error("user null"); throw new Error("user null");
} }

Loading…
Cancel
Save