Skip to content

Commit eba51e0

Browse files
authored
WEB-511 Update login page logo to use tenant-specific branding (#2926)
1 parent 12d00ca commit eba51e0

File tree

9 files changed

+36
-2
lines changed

9 files changed

+36
-2
lines changed

env.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ FINERACT_PLATFORM_TENANT_IDENTIFIER=default
1313
# Tenant Identifiers list delimited by comma
1414
FINERACT_PLATFORM_TENANTS_IDENTIFIER=default
1515

16+
# Tenant Logo URL - supports external URLs (e.g., https://example.com/logo.png) or local paths. Leave empty to use default tenant-specific logos
17+
TENANT_LOGO_URL=
18+
1619
MIFOS_DEFAULT_LANGUAGE=en-US
1720

1821
MIFOS_SUPPORTED_LANGUAGES=cs-CS,de-DE,en-US,es-MX,fr-FR,it-IT,ko-KO,lt-LT,lv-LV,ne-NE,pt-PT

src/app/login/login.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h1 class="mat-display-1 cover-title">{{ 'APP_NAME' | translate }}</h1>
5050

5151
<!-- Logo with Organization Name -->
5252
<div class="layout-row align-center-center flex-auto">
53-
<img src="assets/images/mifos_lg-logo.png" alt="{{ 'APP_NAME' | translate }} Logo" class="img-container" />
53+
<img [src]="logoPath" (error)="onLogoError()" alt="{{ 'APP_NAME' | translate }} Logo" class="img-container" />
5454
</div>
5555

5656
<!-- Form Section -->

src/app/login/login.component.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ export class LoginComponent implements OnInit, OnDestroy {
6565
twoFactorAuthenticationRequired = false;
6666
/** Subscription to alerts. */
6767
alert$: Subscription;
68+
logoPath = 'assets/images/default_home.png';
6869

6970
/**
7071
* Subscribes to alert event of alert service.
7172
*/
7273
ngOnInit() {
74+
this.updateLogo();
7375
this.alert$ = this.alertService.alertEvent.subscribe((alertEvent: Alert) => {
7476
const alertType = alertEvent.type;
7577
if (alertType === 'Password Expired') {
@@ -82,6 +84,8 @@ export class LoginComponent implements OnInit, OnDestroy {
8284
this.resetPassword = false;
8385
this.twoFactorAuthenticationRequired = false;
8486
this.router.navigate(['/'], { replaceUrl: true });
87+
} else if (alertType === 'Tenant Changed') {
88+
this.updateLogo();
8589
}
8690
});
8791
}
@@ -112,4 +116,21 @@ export class LoginComponent implements OnInit, OnDestroy {
112116
allowServerSwitch(): boolean {
113117
return environment.allowServerSwitch === 'false' ? false : true;
114118
}
119+
120+
updateLogo(): void {
121+
if (environment.tenantLogoUrl && environment.tenantLogoUrl.trim() !== '') {
122+
this.logoPath = environment.tenantLogoUrl;
123+
return;
124+
}
125+
const tenant = this.settingsService.tenantIdentifier;
126+
if (tenant && tenant !== 'default') {
127+
this.logoPath = `assets/images/${tenant}_home.png`;
128+
} else {
129+
this.logoPath = 'assets/images/default_home.png';
130+
}
131+
}
132+
133+
onLogoError(): void {
134+
this.logoPath = 'assets/images/default_home.png';
135+
}
115136
}

src/app/shared/tenant-selector/tenant-selector.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, OnInit, inject } from '@angular/core';
22
import { UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
33
import { SettingsService } from 'app/settings/settings.service';
4+
import { AlertService } from 'app/core/alert/alert.service';
45
import { MatFormField, MatPrefix, MatLabel } from '@angular/material/form-field';
56
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
67
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
@@ -17,6 +18,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
1718
})
1819
export class TenantSelectorComponent implements OnInit {
1920
private settingsService = inject(SettingsService);
21+
private alertService = inject(AlertService);
2022

2123
/** Tenant selector form control. */
2224
tenantSelector = new UntypedFormControl();
@@ -40,6 +42,7 @@ export class TenantSelectorComponent implements OnInit {
4042

4143
setTenantIdentifier(): void {
4244
this.settingsService.setTenantIdentifier(this.tenantSelector.value);
45+
this.alertService.alert({ type: 'Tenant Changed', message: this.tenantSelector.value });
4346
}
4447

4548
allowSelection(): boolean {

src/assets/env.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
window["env"]["fineractPlatformTenantId"] = '';
1313
window["env"]["fineractPlatformTenantIds"] = '';
1414

15+
window['env']['tenantLogoUrl'] = '';
16+
1517
// Language Environment variables
1618
window["env"]["defaultLanguage"] = '';
1719
window["env"]["supportedLanguages"] = '';

src/assets/env.template.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
window['env']['fineractPlatformTenantId'] = '$FINERACT_PLATFORM_TENANT_IDENTIFIER';
1313
window['env']['fineractPlatformTenantIds'] = '$FINERACT_PLATFORM_TENANTS_IDENTIFIER';
1414

15+
window['env']['tenantLogoUrl'] = '$TENANT_LOGO_URL';
16+
1517
// Language Environment variables
1618
window['env']['defaultLanguage'] = '$MIFOS_DEFAULT_LANGUAGE';
1719
window['env']['supportedLanguages'] = '$MIFOS_SUPPORTED_LANGUAGES';

src/environments/environment.prod.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const environment = {
5252

5353
displayBackEndInfo: loadedEnv['displayBackEndInfo'] || 'true',
5454
displayTenantSelector: loadedEnv['displayTenantSelector'] || 'true',
55+
tenantLogoUrl: loadedEnv['tenantLogoUrl'] || 'assets/images/mifos_lg-logo.png',
5556
// Time in seconds, default 60 seconds
5657
waitTimeForNotifications: loadedEnv['waitTimeForNotifications'] || 60,
5758
// Time in seconds, default 30 seconds

src/environments/environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export const environment = {
5656

5757
displayBackEndInfo: loadedEnv.displayBackEndInfo || 'true',
5858
displayTenantSelector: loadedEnv.displayTenantSelector || 'true',
59+
tenantLogoUrl: loadedEnv.tenantLogoUrl || 'assets/images/mifos_lg-logo.png',
5960
// Time in seconds, default 60 seconds
6061
waitTimeForNotifications: loadedEnv.waitTimeForNotifications || 60,
6162
// Time in seconds, default 30 seconds

src/theme/_dark_content.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ body.dark-theme {
271271

272272
// Home page logo styling for dark mode
273273
mifosx-home {
274-
[src*='mifos_lg-logo.png'] {
274+
[src*='mifos_lg-logo.png'],
275+
[src$='_home.png'] {
275276
content: url('../assets/images/white-mifos.png');
276277
}
277278
}

0 commit comments

Comments
 (0)