mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-11 05:51:28 +03:00
Fixed bug that prevented registration from occuring
This commit is contained in:
@@ -1764,7 +1764,7 @@ const optionalJwt = function (req, res, next) {
|
|||||||
const type = using_body ? req.body.type : req.query.type;
|
const type = using_body ? req.body.type : req.query.type;
|
||||||
const is_shared = auth_api.getUserVideo(uuid, uid, type, true);
|
const is_shared = auth_api.getUserVideo(uuid, uid, type, true);
|
||||||
if (is_shared) return next();
|
if (is_shared) return next();
|
||||||
} else if (multiUserMode) {
|
} else if (multiUserMode && !(req.path.includes('/api/auth/register') && !req.query.jwt)) { // registration should get passed through
|
||||||
if (!req.query.jwt) {
|
if (!req.query.jwt) {
|
||||||
res.sendStatus(401);
|
res.sendStatus(401);
|
||||||
return;
|
return;
|
||||||
@@ -2744,6 +2744,7 @@ app.get('/api/audio/:id', optionalJwt, function(req , res){
|
|||||||
// user authentication
|
// user authentication
|
||||||
|
|
||||||
app.post('/api/auth/register'
|
app.post('/api/auth/register'
|
||||||
|
, optionalJwt
|
||||||
, auth_api.registerUser);
|
, auth_api.registerUser);
|
||||||
app.post('/api/auth/login'
|
app.post('/api/auth/login'
|
||||||
, auth_api.passport.authenticate('local', {})
|
, auth_api.passport.authenticate('local', {})
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ exports.registerUser = function(req, res) {
|
|||||||
var username = req.body.username;
|
var username = req.body.username;
|
||||||
var plaintextPassword = req.body.password;
|
var plaintextPassword = req.body.password;
|
||||||
|
|
||||||
if (userid !== 'admin' && !config_api.getConfigItem('ytdl_allow_registration')) {
|
if (userid !== 'admin' && !config_api.getConfigItem('ytdl_allow_registration') && !req.isAuthenticated() && (!req.user || !exports.userHasPermission(req.user.uid, 'settings'))) {
|
||||||
res.sendStatus(409);
|
res.sendStatus(409);
|
||||||
logger.error(`Registration failed for user ${userid}. Registration is disabled.`);
|
logger.error(`Registration failed for user ${userid}. Registration is disabled.`);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user