#39 - Être capable de désactiver les inscriptions + maj footer
This commit is contained in:
parent
9dd7a35f22
commit
12ca71e643
9 changed files with 69 additions and 24 deletions
|
@ -7,6 +7,8 @@ import Auth from "../middleware/Auth";
|
|||
|
||||
import render from "../libs/format";
|
||||
|
||||
import { registrationOpen } from "../config";
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
const router = express.Router();
|
||||
|
||||
|
@ -59,11 +61,33 @@ router
|
|||
}
|
||||
);
|
||||
|
||||
router
|
||||
.route("/inscription")
|
||||
.get((req, res, next) => {
|
||||
if (registrationOpen) {
|
||||
router
|
||||
.route("/inscription")
|
||||
.get((req, res, next) => {
|
||||
try {
|
||||
const page = new Pages(req, "inscription/index");
|
||||
|
||||
page.setPageTitle("Inscription");
|
||||
|
||||
render(res, page);
|
||||
} catch (err) {
|
||||
next(err);
|
||||
}
|
||||
})
|
||||
.post(async (req, res) => {
|
||||
try {
|
||||
await Auth.register(req);
|
||||
|
||||
res.redirect("/");
|
||||
} catch (err) {
|
||||
res.redirect("/inscription");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.route("/inscription").get((req, res, next) => {
|
||||
try {
|
||||
const page = new Pages(req, "inscription");
|
||||
const page = new Pages(req, "inscription/desactivee");
|
||||
|
||||
page.setPageTitle("Inscription");
|
||||
|
||||
|
@ -71,16 +95,8 @@ router
|
|||
} catch (err) {
|
||||
next(err);
|
||||
}
|
||||
})
|
||||
.post(async (req, res) => {
|
||||
try {
|
||||
await Auth.register(req);
|
||||
|
||||
res.redirect("/");
|
||||
} catch (err) {
|
||||
res.redirect("/inscription");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
router
|
||||
.route("/ajouter-un-album")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue