Skip to content
Snippets Groups Projects
Commit a7f79daa authored by kbeyro's avatar kbeyro
Browse files

hide recaptcha emblem when not used

parent d66ac9bc
No related branches found
No related tags found
1 merge request!185hide recaptcha emblem when not used
...@@ -34,6 +34,7 @@ import {SplitButtonModule} from 'primeng/splitbutton'; ...@@ -34,6 +34,7 @@ import {SplitButtonModule} from 'primeng/splitbutton';
import {MenuModule} from 'primeng/menu'; import {MenuModule} from 'primeng/menu';
import { AdminLeftMenuComponent } from './shared/admin-left-menu/admin-left-menu.component'; import { AdminLeftMenuComponent } from './shared/admin-left-menu/admin-left-menu.component';
import {AccordionModule} from 'primeng/accordion'; import {AccordionModule} from 'primeng/accordion';
import { RecaptchaVisibilityService } from './service/recaptcha-visibility.service';
export function appConfigFactory(config: AppConfigService) { export function appConfigFactory(config: AppConfigService) {
return function create() { return function create() {
...@@ -98,6 +99,7 @@ export const jwtOptionsFactory = (appConfig: AppConfigService) => ({ ...@@ -98,6 +99,7 @@ export const jwtOptionsFactory = (appConfig: AppConfigService) => ({
providers: [ providers: [
AuthGuard, AuthGuard,
AuthService, AuthService,
RecaptchaVisibilityService,
AppConfigService, AppConfigService,
provideZxvbnServiceForPSM(), provideZxvbnServiceForPSM(),
{ {
......
import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class RecaptchaVisibilityService {
showBadge(): void {
const badge = document.querySelector('.grecaptcha-badge') as HTMLElement;
if (badge) {
badge.style.visibility = 'visible';
}
}
hideBadge(): void {
const badge = document.querySelector('.grecaptcha-badge') as HTMLElement;
if (badge) {
badge.style.visibility = 'hidden';
}
}
}
import {Component, OnInit} from '@angular/core'; import {Component, OnDestroy, OnInit} from '@angular/core';
import {AppConfigService, ChangelogService} from '../../service'; import {AppConfigService, ChangelogService} from '../../service';
import {GitInfo} from '../../model/gitinfo'; import {GitInfo} from '../../model/gitinfo';
import { RecaptchaVisibilityService } from '../../service/recaptcha-visibility.service';
@Component({ @Component({
selector: 'app-about', selector: 'app-about',
templateUrl: './about.component.html', templateUrl: './about.component.html',
styleUrls: ['./about.component.css'] styleUrls: ['./about.component.css']
}) })
export class AboutComponent implements OnInit { export class AboutComponent implements OnInit, OnDestroy {
public gitInfo: GitInfo; public gitInfo: GitInfo;
constructor(private changelogService: ChangelogService, constructor(private changelogService: ChangelogService,
private appConfigService: AppConfigService) { private appConfigService: AppConfigService,
private readonly recaptcha: RecaptchaVisibilityService) {
} }
ngOnInit() { ngOnInit() {
this.recaptcha.showBadge();
if (this.appConfigService.getShowGitInfo()) { if (this.appConfigService.getShowGitInfo()) {
this.changelogService.getGitInfo().subscribe(info => this.gitInfo = info); this.changelogService.getGitInfo().subscribe(info => this.gitInfo = info);
} }
} }
ngOnDestroy(): void {
this.recaptcha.hideBadge();
}
} }
...@@ -72,6 +72,7 @@ import { BrowserModule } from '@angular/platform-browser'; ...@@ -72,6 +72,7 @@ import { BrowserModule } from '@angular/platform-browser';
import {ChartModule} from 'primeng/chart'; import {ChartModule} from 'primeng/chart';
import { RolesExcludedDirective } from '../directive/roles-exluded.directive'; import { RolesExcludedDirective } from '../directive/roles-exluded.directive';
import { FileUploadModule } from 'primeng/fileupload'; import { FileUploadModule } from 'primeng/fileupload';
import { RecaptchaVisibilityService } from '../service/recaptcha-visibility.service';
...@@ -155,6 +156,7 @@ import { FileUploadModule } from 'primeng/fileupload'; ...@@ -155,6 +156,7 @@ import { FileUploadModule } from 'primeng/fileupload';
PasswordValidator, PasswordValidator,
UserDataService, UserDataService,
NotificationService, NotificationService,
RecaptchaVisibilityService,
AppConfigService, AppConfigService,
DatePipe, DatePipe,
{ {
......
import {AppConfigService} from '../service/appconfig.service'; import {AppConfigService} from '../service/appconfig.service';
import {AfterContentChecked, AfterViewChecked, Component, OnInit,} from '@angular/core'; import {AfterContentChecked, AfterViewChecked, Component, OnDestroy, OnInit,} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {ServiceUnavailableService} from '../service-unavailable/service-unavailable.service'; import {ServiceUnavailableService} from '../service-unavailable/service-unavailable.service';
import { RecaptchaVisibilityService } from '../service/recaptcha-visibility.service';
@Component({ @Component({
selector: 'app-welcome', selector: 'app-welcome',
templateUrl: './welcome.component.html', templateUrl: './welcome.component.html',
styleUrls: ['./welcome.component.css'] styleUrls: ['./welcome.component.css']
}) })
export class WelcomeComponent implements OnInit, AfterViewChecked, AfterContentChecked { export class WelcomeComponent implements OnInit, AfterViewChecked, AfterContentChecked, OnDestroy {
private height = 0; private height = 0;
...@@ -19,7 +20,8 @@ export class WelcomeComponent implements OnInit, AfterViewChecked, AfterContentC ...@@ -19,7 +20,8 @@ export class WelcomeComponent implements OnInit, AfterViewChecked, AfterContentC
constructor(private appConfig: AppConfigService, constructor(private appConfig: AppConfigService,
public router: Router, public router: Router,
private serviceHealth: ServiceUnavailableService, private serviceHealth: ServiceUnavailableService,
private readonly route: ActivatedRoute) { private readonly route: ActivatedRoute,
private readonly recaptcha: RecaptchaVisibilityService) {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
console.log(params) console.log(params)
if (params.logout !== undefined) { if (params.logout !== undefined) {
...@@ -38,14 +40,21 @@ export class WelcomeComponent implements OnInit, AfterViewChecked, AfterContentC ...@@ -38,14 +40,21 @@ export class WelcomeComponent implements OnInit, AfterViewChecked, AfterContentC
this.landingProfile = this.appConfig.getLandingProfile(); this.landingProfile = this.appConfig.getLandingProfile();
console.log("Landing profile = ", this.landingProfile) console.log("Landing profile = ", this.landingProfile)
this.recaptcha.showBadge();
} }
ngAfterContentChecked() { ngAfterContentChecked() {
// this.onResize(); // this.onResize();
this.recaptcha.showBadge();
} }
ngAfterViewChecked() { ngAfterViewChecked() {
// this.onResize(); // this.onResize();
this.recaptcha.showBadge();
}
ngOnDestroy(): void {
this.recaptcha.hideBadge();
} }
public onCloseBanner() { public onCloseBanner() {
......
...@@ -240,3 +240,8 @@ body .p-datatable .p-sortable-column.p-highlight{ ...@@ -240,3 +240,8 @@ body .p-datatable .p-sortable-column.p-highlight{
body .p-datatable .p-sortable-column.p-highlight .p-sortable-column-icon{ body .p-datatable .p-sortable-column.p-highlight .p-sortable-column-icon{
color:var(--primary-button-color); color:var(--primary-button-color);
} }
.grecaptcha-badge {
visibility: hidden;
bottom: 45px !important;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment