From 82e7f5ef94ea92eb4d598be808f61da12d89c73b Mon Sep 17 00:00:00 2001 From: dweinholz Date: Tue, 18 Apr 2023 17:01:55 +0200 Subject: [PATCH] updated info --- .../public-key/public-key.component.html | 15 +- .../public-key/public-key.component.ts | 208 +++++++++--------- 2 files changed, 116 insertions(+), 107 deletions(-) diff --git a/src/app/shared/shared_modules/public-key/public-key.component.html b/src/app/shared/shared_modules/public-key/public-key.component.html index a6e0bb9e96..a705b382af 100644 --- a/src/app/shared/shared_modules/public-key/public-key.component.html +++ b/src/app/shared/shared_modules/public-key/public-key.component.html @@ -58,9 +58,12 @@
- Warning Due to the security concerns, your key has been blocked permanently, and you won't be + Warning Due to security concerns, your key has been blocked permanently, and you won't be able to use it anymore. It's highly recommended that you change your key immediately to prevent any further - security breaches. + security breaches.
+ If you have questions or need help, please E-Mail us at + {{ CLOUD_PORTAL_SUPPORT_MAIL }}.
@@ -184,9 +187,13 @@ Warning This is not a valid public key! - WarningDue to the security concerns, your key has been blocked permanently, and you won't be + WarningDue to security concerns, your key has been blocked permanently, and you won't be able to use it anymore. It's highly recommended that you change your key immediately to prevent any further - security breaches. + security breaches.
+ If you have questions or need help, please E-Mail us at + {{ CLOUD_PORTAL_SUPPORT_MAIL }}. +
Currently supported public key formats are RSA and ECDSA (SHA2, NIST P256, P384 or P521). diff --git a/src/app/shared/shared_modules/public-key/public-key.component.ts b/src/app/shared/shared_modules/public-key/public-key.component.ts index ec3253f2a7..5f64402d33 100644 --- a/src/app/shared/shared_modules/public-key/public-key.component.ts +++ b/src/app/shared/shared_modules/public-key/public-key.component.ts @@ -1,126 +1,128 @@ import { - Component, EventEmitter, Input, OnInit, Output, + Component, EventEmitter, Input, OnInit, Output, } from '@angular/core'; -import { ClipboardService } from 'ngx-clipboard'; -import { saveAs } from 'file-saver'; -import { BsModalService } from 'ngx-bootstrap/modal'; -import { KeyService } from '../../../api-connector/key.service'; -import { ApiSettings } from '../../../api-connector/api-settings.service'; -import { Userinfo } from '../../../userinfo/userinfo.model'; -import { IResponseTemplate } from '../../../api-connector/response-template'; -import { AbstractBaseClass } from '../baseClass/abstract-base-class'; -import { WIKI_GENERATE_KEYS } from '../../../../links/links'; -import { NotificationModalComponent } from '../../modal/notification-modal'; -import { BlacklistedResponse } from '../../../api-connector/response-interfaces'; +import {ClipboardService} from 'ngx-clipboard'; +import {saveAs} from 'file-saver'; +import {BsModalService} from 'ngx-bootstrap/modal'; +import {KeyService} from '../../../api-connector/key.service'; +import {ApiSettings} from '../../../api-connector/api-settings.service'; +import {Userinfo} from '../../../userinfo/userinfo.model'; +import {IResponseTemplate} from '../../../api-connector/response-template'; +import {AbstractBaseClass} from '../baseClass/abstract-base-class'; +import {WIKI_GENERATE_KEYS} from '../../../../links/links'; +import {NotificationModalComponent} from '../../modal/notification-modal'; +import {BlacklistedResponse} from '../../../api-connector/response-interfaces'; +import {CLOUD_PORTAL_SUPPORT_MAIL} from '../../../../links/links' /** * Public Key component. */ @Component({ - // eslint-disable-next-line @angular-eslint/component-selector - selector: '[app-public-key]', - templateUrl: './public-key.component.html', - styleUrls: ['./public-key.component.scss'], - providers: [ApiSettings, KeyService], + // eslint-disable-next-line @angular-eslint/component-selector + selector: '[app-public-key]', + templateUrl: './public-key.component.html', + styleUrls: ['./public-key.component.scss'], + providers: [ApiSettings, KeyService], }) export class PublicKeyComponent extends AbstractBaseClass implements OnInit { - WIKI_GENERATE_KEYS: string = WIKI_GENERATE_KEYS; - public_key: string; - validated_key: boolean = false; - blocked_key: boolean = false; - current_key_blocked: boolean = false; - acknowledgement_given: boolean = false; - @Input() userinfo: Userinfo; - @Output() readonly currentKeyBlockedChanged: EventEmitter = new EventEmitter(); + WIKI_GENERATE_KEYS: string = WIKI_GENERATE_KEYS; + public_key: string; + validated_key: boolean = false; + blocked_key: boolean = false; + current_key_blocked: boolean = false; + acknowledgement_given: boolean = false; + @Input() userinfo: Userinfo; + @Output() readonly currentKeyBlockedChanged: EventEmitter = new EventEmitter(); + CLOUD_PORTAL_SUPPORT_MAIL: string= CLOUD_PORTAL_SUPPORT_MAIL - constructor( - private keyService: KeyService, - private clipboardService: ClipboardService, - private modalService: BsModalService, - ) { - super(); - } + constructor( + private keyService: KeyService, + private clipboardService: ClipboardService, + private modalService: BsModalService, + ) { + super(); + } - ngOnInit() { - if (this.userinfo?.PublicKey) { - this.isCurrentKeyBlocked(); + ngOnInit() { + if (this.userinfo?.PublicKey) { + this.isCurrentKeyBlocked(); + } } - } - downloadPem(data: string): void { - const blob: Blob = new Blob([data], { type: 'pem' }); - const url: string = window.URL.createObjectURL(blob); - saveAs(url, `${this.userinfo.UserLogin}_ecdsa`); - } + downloadPem(data: string): void { + const blob: Blob = new Blob([data], {type: 'pem'}); + const url: string = window.URL.createObjectURL(blob); + saveAs(url, `${this.userinfo.UserLogin}_ecdsa`); + } - generateKey(): void { - this.keyService.generateKey().subscribe((res: any): void => { - this.getUserPublicKey(); - this.downloadPem(res['private_key']); - }); - } + generateKey(): void { + this.keyService.generateKey().subscribe((res: any): void => { + this.getUserPublicKey(); + this.downloadPem(res['private_key']); + }); + } - isKeyBlocked(): void { - this.keyService.isBlocked(this.public_key.trim()).subscribe((res: BlacklistedResponse) => { - this.blocked_key = res.blacklisted; - }); - } + isKeyBlocked(): void { + this.keyService.isBlocked(this.public_key.trim()).subscribe((res: BlacklistedResponse) => { + this.blocked_key = res.blacklisted; + }); + } - isCurrentKeyBlocked(): void { - this.keyService.isBlocked(this.userinfo.PublicKey).subscribe((res: BlacklistedResponse) => { - this.current_key_blocked = res.blacklisted; - this.currentKeyBlockedChanged.emit(this.current_key_blocked); - }); - } + isCurrentKeyBlocked(): void { + this.keyService.isBlocked(this.userinfo.PublicKey).subscribe((res: BlacklistedResponse) => { + this.current_key_blocked = res.blacklisted; + this.currentKeyBlockedChanged.emit(this.current_key_blocked); + }); + } - validateKey(): void { - this.keyService.validateKey(this.public_key.trim()).subscribe( - (res: any) => { - this.validated_key = res['status'] === 'valid'; - }, - () => { - this.validated_key = false; - }, - ); - } + validateKey(): void { + this.keyService.validateKey(this.public_key.trim()).subscribe( + (res: any) => { + this.validated_key = res['status'] === 'valid'; + }, + () => { + this.validated_key = false; + }, + ); + } - importKey(): void { - const re: RegExp = /\+/gi; + importKey(): void { + const re: RegExp = /\+/gi; - this.keyService.postKey(this.public_key.replace(re, '%2B').trim()).subscribe({ - next: (): void => { - this.getUserPublicKey(); - const initialState = { - notificationModalTitle: 'Success', - notificationModalType: 'info', - notificationModalMessage: 'The new public key got successfully set', - }; - this.modalService.show(NotificationModalComponent, { initialState }); - }, - error: (): any => { - const initialState = { - notificationModalTitle: 'Error', - notificationModalType: 'danger', - notificationModalMessage: - 'We were not able successfully set a new public key. Please enter a valid public key!', - }; - this.modalService.show(NotificationModalComponent, { initialState }); - }, - }); - } + this.keyService.postKey(this.public_key.replace(re, '%2B').trim()).subscribe({ + next: (): void => { + this.getUserPublicKey(); + const initialState = { + notificationModalTitle: 'Success', + notificationModalType: 'info', + notificationModalMessage: 'The new public key got successfully set', + }; + this.modalService.show(NotificationModalComponent, {initialState}); + }, + error: (): any => { + const initialState = { + notificationModalTitle: 'Error', + notificationModalType: 'danger', + notificationModalMessage: + 'We were not able successfully set a new public key. Please enter a valid public key!', + }; + this.modalService.show(NotificationModalComponent, {initialState}); + }, + }); + } - copyToClipboard(text: string): void { - if (this.clipboardService.isSupported) { - this.clipboardService.copy(text); - } else { - super.copyToClipboard(text); + copyToClipboard(text: string): void { + if (this.clipboardService.isSupported) { + this.clipboardService.copy(text); + } else { + super.copyToClipboard(text); + } } - } - getUserPublicKey(): void { - this.keyService.getKey().subscribe((key: IResponseTemplate): void => { - this.userinfo.PublicKey = key.value as string; - this.isKeyBlocked(); - }); - } + getUserPublicKey(): void { + this.keyService.getKey().subscribe((key: IResponseTemplate): void => { + this.userinfo.PublicKey = key.value as string; + this.isKeyBlocked(); + }); + } }