🛂 Remove page reload on auth failure (#981)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
module.exports = (config, req) => {
|
||||
try {
|
||||
if ( config.appConfig.auth.enableHeaderAuth ) {
|
||||
const userHeader = config.appConfig.auth.headerAuth.userHeader;
|
||||
const proxyWhitelist = config.appConfig.auth.headerAuth.proxyWhitelist;
|
||||
if ( proxyWhitelist.includes(req.socket.remoteAddress) ) {
|
||||
return { "success": true, "user": req.headers[userHeader.toLowerCase()] };
|
||||
if (config.appConfig.auth.enableHeaderAuth) {
|
||||
const { userHeader } = config.appConfig.auth.headerAuth;
|
||||
const { proxyWhitelist } = config.appConfig.auth.headerAuth;
|
||||
if (proxyWhitelist.includes(req.socket.remoteAddress)) {
|
||||
return { success: true, user: req.headers[userHeader.toLowerCase()] };
|
||||
}
|
||||
}
|
||||
return {};
|
||||
} catch (e) {
|
||||
console.warn("Error get-user: ", e);
|
||||
return { 'success': false };
|
||||
console.warn('Error get-user: ', e);
|
||||
return { success: false };
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user