Custom logo and styles (#68)

* 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 <martin.svec@slovenskoit.sk>
This commit is contained in:
smartin77 2024-05-02 10:16:45 +02:00 committed by GitHub
parent 41c5ac3626
commit ce92321285
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 5 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea
ldap-user-manager.iml

View File

@ -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`.

View File

@ -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'])) {

View File

@ -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) {
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php print $SERVER_PATH; ?>bootstrap/css/bootstrap.min.css">
<?php if ($CUSTOM_STYLES) echo '<link rel="stylesheet" href="'.$CUSTOM_STYLES.'">' ?>
<script src="<?php print $SERVER_PATH; ?>js/jquery-3.6.0.min.js"></script>
<script src="<?php print $SERVER_PATH; ?>bootstrap/js/bootstrap.min.js"></script>
</HEAD>
@ -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;
?>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#"><?php print $SITE_NAME ?></a>
</div>
<div class="navbar-header"><?php
if ($CUSTOM_LOGO) echo '<span class="navbar-brand"><img src="'.$CUSTOM_LOGO.'" class="logo" alt="logo"></span>'
?><a class="navbar-brand" href="./"><?php print $SITE_NAME ?></a>
</div>
<ul class="nav navbar-nav">
<?php
foreach ($MODULES as $module => $access) {