mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
webaccess: Use .startsWith()
instead of .search()
This commit is contained in:
parent
b9118c22ba
commit
dcd43e9849
1 changed files with 1 additions and 2 deletions
|
@ -146,8 +146,7 @@ const checkAccess = async (req, res, next) => {
|
||||||
const ctx = {req, res, users: settings.users, next};
|
const ctx = {req, res, users: settings.users, next};
|
||||||
// If the HTTP basic auth header is present, extract the username and password so it can be given
|
// If the HTTP basic auth header is present, extract the username and password so it can be given
|
||||||
// to authn plugins.
|
// to authn plugins.
|
||||||
const httpBasicAuth =
|
const httpBasicAuth = req.headers.authorization && req.headers.authorization.startsWith('Basic ');
|
||||||
req.headers.authorization && req.headers.authorization.search('Basic ') === 0;
|
|
||||||
if (httpBasicAuth) {
|
if (httpBasicAuth) {
|
||||||
const userpass =
|
const userpass =
|
||||||
Buffer.from(req.headers.authorization.split(' ')[1], 'base64').toString().split(':');
|
Buffer.from(req.headers.authorization.split(' ')[1], 'base64').toString().split(':');
|
||||||
|
|
Loading…
Reference in a new issue