From ce92321285129d34d44ba1babe72b4d09e893a44 Mon Sep 17 00:00:00 2001 From: smartin77 Date: Thu, 2 May 2024 10:16:45 +0200 Subject: [PATCH] Custom logo and styles (#68) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * New user - Remove accents/diacritics from Username and Email while typing * .gitignore added * custom logo firts commit * relative path to image * relative path adjusted * bootstrap update to v.4.3.1 * Revert "bootstrap update to v.4.3.1" This reverts commit 62792e4136dabe357fab8f09defb13388f023bf6. * modified header inline blocks * span fix * hardcoded logo * hardcoded logo - style fix * hardcoded logo - style fix #2 * IMG element * modified IMG * modified IMG #2 * modified IMG #3 * adding custom styles * custom styles used * Update README.md Website logo and styles customisation * Update README.md typo... --------- Co-authored-by: Martin Švec --- .gitignore | 2 ++ README.md | 18 ++++++++++++++++++ www/includes/config.inc.php | 3 +++ www/includes/web_functions.inc.php | 12 +++++++----- 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b32c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +ldap-user-manager.iml diff --git a/README.md b/README.md index 28ae3ea..be783a6 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,24 @@ To send emails you'll need to use an existing SMTP server. Email sending will b * `ACCOUNT_REQUESTS_EMAIL` (default: *{EMAIL_FROM_ADDRESS}*): This is the email address that any requests for a new account are sent to. +#### Website customization + +* `$CUSTOM_LOGO` (default: *FALSE*)*: If this is defined with path to image file, then this image will be displayed in header. You need also mount volume with this file. + +* `$CUSTOM_STYLES` (default: *FALSE*)*: If this is defined with path to css file, then this style will be used in header. Also helps vith logo positioninig. You need also mount volume with this file. + +docker-compose.yml example: + +```yaml +ldap-user-manager: + environment: + CUSTOM_LOGO: "../gfx/logo.svg" + CUSTOM_STYLES: "../css/custom.css" + volumes: + - '/opt/openldap/www/gfx:/opt/ldap_user_manager/gfx' + - '/opt/openldap/www/css:/opt/ldap_user_manager/css' +``` + #### Debugging settings * `LDAP_DEBUG` (default: *FALSE*): Set to TRUE to increase the logging level for LDAP requests. This will output passwords to the error log - don't enable this in a production environment. This is for information on problems updating LDAP records and such. To debug problems connecting to the LDAP server in the first place use `LDAP_VERBOSE_CONNECTION_LOGS`. diff --git a/www/includes/config.inc.php b/www/includes/config.inc.php index 77c1935..d62de2d 100644 --- a/www/includes/config.inc.php +++ b/www/includes/config.inc.php @@ -169,6 +169,9 @@ # Sanity checking + $CUSTOM_LOGO = (getenv('CUSTOM_LOGO') ? getenv('CUSTOM_LOGO') : FALSE); + $CUSTOM_STYLES = (getenv('CUSTOM_STYLES') ? getenv('CUSTOM_STYLES') : FALSE); + $errors = ""; if (empty($LDAP['uri'])) { diff --git a/www/includes/web_functions.inc.php b/www/includes/web_functions.inc.php index dea3fc0..0efa695 100644 --- a/www/includes/web_functions.inc.php +++ b/www/includes/web_functions.inc.php @@ -247,7 +247,7 @@ function log_out($method='normal') { function render_header($title="",$menu=TRUE) { - global $SITE_NAME, $IS_ADMIN, $SENT_HEADERS, $SERVER_PATH; + global $SITE_NAME, $IS_ADMIN, $SENT_HEADERS, $SERVER_PATH, $CUSTOM_STYLES; if (empty($title)) { $title = $SITE_NAME; } @@ -260,6 +260,7 @@ function render_header($title="",$menu=TRUE) { + ' ?> @@ -295,14 +296,15 @@ function render_menu() { #Render the navigation menu. #The menu is dynamically rendered the $MODULES hash - global $SITE_NAME, $MODULES, $THIS_MODULE, $VALIDATED, $IS_ADMIN, $USER_ID, $SERVER_PATH; + global $SITE_NAME, $MODULES, $THIS_MODULE, $VALIDATED, $IS_ADMIN, $USER_ID, $SERVER_PATH, $CUSTOM_LOGO; ?>