mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
add route for QR codes (#7902)
* add route for QR codes * check that passed ID is a UUID * add test for qr code redirect * fix qr code test
This commit is contained in:
committed by
Matteo Pagliazzi
parent
e68c75c802
commit
7ef2c34177
17
website/server/controllers/top-level/qrcodes.js
Normal file
17
website/server/controllers/top-level/qrcodes.js
Normal file
@@ -0,0 +1,17 @@
|
||||
let api = {};
|
||||
|
||||
api.redirectProfileQRCode = {
|
||||
method: 'GET',
|
||||
url: '/qr-code/user/:memberid',
|
||||
runCron: false,
|
||||
async handler (req, res) {
|
||||
req.checkParams('memberid', res.t('memberIdRequired')).notEmpty().isUUID();
|
||||
|
||||
let validationErrors = req.validationErrors();
|
||||
if (validationErrors) throw validationErrors;
|
||||
|
||||
res.redirect(301, `/static/front/#?memberId=${req.params.memberid}`);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = api;
|
||||
Reference in New Issue
Block a user