the last few things.

This commit is contained in:
2020-08-09 16:12:12 +02:00
parent 5fe56eaae8
commit 6aef0412e8
13 changed files with 106 additions and 136 deletions
+9 -5
View File
@@ -17,12 +17,16 @@ router.get("/login", saveReferer, passport.authenticate("auth0", {scope: "openid
res.redirect("/")
})
router.get("/callback", passport.authenticate("auth0"), (req, res) => {
if (req.user == null) {
throw new Error("user null");
}
router.get("/callback", function (req, res, next) {
passport.authenticate("auth0", function (err, user, info) {
if (err) { return next(err) }
if (!user) { console.log(err, user, info); return res.redirect("/auth/login") }
req.logIn(user, function (err) {
if (err) { return next(err) }
res.redirect(req.session.loginReferrer || "/");
res.redirect(req.session.loginReferrer || "/");
})
})(req, res, next);
})
router.get("/user", (req, res) => {
+3 -1
View File
@@ -6,8 +6,10 @@ const {changesApi} = require("../../rpdata/api/Change")
const changesTemplate = require("../../marko/page/data/changes.marko")
router.get("/", async(req, res) => {
const limit = parseInt(req.query.limit) || 100
res.markoAsync(changesTemplate, {
changes: changesApi.list({limit: 1000}),
changes: changesApi.list({limit}),
selected: {changes: true},
})
})