diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index d1b7cf66..bd4a836d 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -13,5 +13,5 @@ services:
- NET_ADMIN
- SYS_MODULE
environment:
- # - PASSWORD_HASH=p
+ # - PASSWORD=p
- WG_HOST=192.168.1.233
diff --git a/src/lib/Server.js b/src/lib/Server.js
index 9a6c143f..3de37c73 100644
--- a/src/lib/Server.js
+++ b/src/lib/Server.js
@@ -128,7 +128,7 @@ module.exports = class Server {
// WireGuard
app.use(
- fromNodeMiddleware((req, res, next) => {
+ fromNodeMiddleware(async (req, res, next) => {
if (!requiresPassword || !req.url.startsWith('/api/')) {
return next();
}
@@ -138,14 +138,14 @@ module.exports = class Server {
}
if (req.url.startsWith('/api/') && req.headers['authorization']) {
- // when I debug req.headers['authorization'], I have nothing
- // if (isPasswordValid(req.headers['authorization'])) {
- // return next();
- // }
- // return res.status(401).json({
- // error: 'Incorrect Password',
- // });
- return next();
+ // headers are base64
+ const [username, password] = Buffer.from(req.headers['authorization'].split(' ')[1], 'base64')
+ .toString()
+ .split(':');
+
+ if (await isPasswordValid(username, password)) {
+ return next();
+ }
}
return res.status(401).json({
diff --git a/src/templates/Settings.vue b/src/templates/Settings.vue
index 34a22077..e89f2bc9 100644
--- a/src/templates/Settings.vue
+++ b/src/templates/Settings.vue
@@ -54,7 +54,7 @@ export default {
{{ $t('currentPassword') }}
+ class="outline-none focus:border-red-800 bg-transparent border border-neutral-500 p-2 rounded-md w-full" required />
@@ -62,7 +62,7 @@ export default {
{{ $t('newPassword') }}
+ class="outline-none focus:border-red-800 bg-transparent border border-neutral-500 p-2 rounded-md w-full" required />
@@ -70,10 +70,10 @@ export default {
{{ $t('confirmNewPassword') }}
+ class="outline-none focus:border-red-800 bg-transparent border border-neutral-500 p-2 rounded-md w-full" required />
-