Replaced AUTH_PASSWORD with AUTH_INTERNAL_PASSWORD

This commit is contained in:
Glenn de Haan
2024-09-30 18:53:07 +02:00
parent 4b2e4ce93a
commit 11873f4879
4 changed files with 6 additions and 6 deletions

View File

@@ -75,7 +75,7 @@ services:
# The UniFi SSID WPA/WPA2/WPA3 Password (Can be ignored for 'Open' networks) (Used within templating and 'Scan to Connect')
UNIFI_SSID_PASSWORD: ''
# The password used to log in to the voucher portal Web UI
AUTH_PASSWORD: '0000'
AUTH_INTERNAL_PASSWORD: '0000'
# The Bearer token used for the API
AUTH_TOKEN: '00000000-0000-0000-0000-000000000000'
# OIDC issuer base url provided by oauth provider. Example: https://auth.example.com/.well-known/openid-configuration
@@ -275,10 +275,10 @@ The UniFi Voucher Site provides three options for authenticating access to the w
### 1. Internal Authentication (Default)
By default, the UniFi Voucher Site uses an internal authentication method. You can set the password for this internal authentication using the `AUTH_PASSWORD` environment variable.
By default, the UniFi Voucher Site uses an internal authentication method. You can set the password for this internal authentication using the `AUTH_INTERNAL_PASSWORD` environment variable.
```env
AUTH_PASSWORD: '0000'
AUTH_INTERNAL_PASSWORD: '0000'
```
### 2. OpenID Connect (OIDC) Authentication

View File

@@ -12,7 +12,7 @@ services:
UNIFI_SITE_ID: 'default'
UNIFI_SSID: ''
UNIFI_SSID_PASSWORD: ''
AUTH_PASSWORD: '0000'
AUTH_INTERNAL_PASSWORD: '0000'
AUTH_TOKEN: '00000000-0000-0000-0000-000000000000'
AUTH_OIDC_ISSUER_BASE_URL: ''
AUTH_OIDC_APP_BASE_URL: ''

View File

@@ -18,7 +18,7 @@ module.exports = {
voucherCustom: config('voucher_custom') !== null ? config('voucher_custom') : process.env.VOUCHER_CUSTOM ? process.env.VOUCHER_CUSTOM !== 'false' : true,
serviceWeb: process.env.SERVICE_WEB ? process.env.SERVICE_WEB !== 'false' : true,
serviceApi: config('service_api') || (process.env.SERVICE_API === 'true') || false,
authPassword: process.env.AUTH_PASSWORD || '0000',
authInternalPassword: process.env.AUTH_INTERNAL_PASSWORD || '0000',
authToken: process.env.AUTH_TOKEN || '0000',
authOidcIssuerBaseUrl: process.env.AUTH_OIDC_ISSUER_BASE_URL || '',
authOidcAppBaseUrl: process.env.AUTH_OIDC_APP_BASE_URL || '',

View File

@@ -148,7 +148,7 @@ if(variables.serviceWeb) {
return;
}
const passwordCheck = req.body.password === variables.authPassword;
const passwordCheck = req.body.password === variables.authInternalPassword;
if (!passwordCheck) {
res.cookie('flashMessage', JSON.stringify({type: 'error', message: 'Password Invalid!'}), {httpOnly: true, expires: new Date(Date.now() + 24 * 60 * 60 * 1000)}).redirect(302, `${req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : ''}/login`);