mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-22 14:30:58 -04:00
requires empty username/password if set disableAuth for basic auth
This commit is contained in:
parent
6f868c9ec3
commit
44c8ca9da8
2 changed files with 17 additions and 3 deletions
|
@ -1,6 +1,8 @@
|
|||
const basicAuth = require("express-basic-auth")
|
||||
const passwordHash = require("./password-hash");
|
||||
const { R } = require("redbean-node");
|
||||
const { setting } = require("./util-server");
|
||||
const { debug } = require("../src/util");
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -28,9 +30,18 @@ exports.login = async function (username, password) {
|
|||
}
|
||||
|
||||
function myAuthorizer(username, password, callback) {
|
||||
exports.login(username, password).then((user) => {
|
||||
callback(null, user != null)
|
||||
|
||||
setting("disableAuth").then((result) => {
|
||||
|
||||
if (result) {
|
||||
callback(null, true)
|
||||
} else {
|
||||
exports.login(username, password).then((user) => {
|
||||
callback(null, user != null)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
exports.basicAuth = basicAuth({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue