Merge pull request #41 from 4nt0n10M4/master

🐛 Fix issue #40 with the gallery login
This commit is contained in:
Tanner 2020-07-03 04:19:10 -07:00 committed by GitHub
commit a8110e7882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -9,8 +9,12 @@ async function post(req, res) {
const userIP = req.headers['x-forwarded-for'] || req.connection.remoteAddress || req.socket.remoteAddress || req.connection.socket.remoteAddress;
res.setHeader('Content-Type', 'text/html');
const protocol = this.protocol();
const password = this.c.admin.key;
if (req.body.password !== this.c.admin.key) {
var password = this.c.admin.key;
// Compatibility with old config
if(typeof password == "string"){
password = [password];
}
if (!this.c.admin.key.includes(req.body.password)) {
res.statusCode = 401;
res.render('unauthorized');
res.end();