digital signature finalized

This commit is contained in:
Timo 2021-02-05 15:53:33 +02:00
parent 1baace9e22
commit 31a1852dc4
3 changed files with 15 additions and 18 deletions

View File

@ -35,7 +35,7 @@
/> />
</div> </div>
<div class="red-input-group required w-300" [class.hidden]="!hasDigitalSignatureSet"> <div class="red-input-group required w-300" [class.hidden]="!hasDigitalSignatureSet" *ngIf="!digitalSignatureExists">
<label translate="digital-signature-screen.password.label"></label> <label translate="digital-signature-screen.password.label"></label>
<input formControlName="keySecret" name="keySecret" [placeholder]="'digital-signature-screen.password.placeholder' | translate" /> <input formControlName="keySecret" name="keySecret" [placeholder]="'digital-signature-screen.password.placeholder' | translate" />
</div> </div>

View File

@ -35,7 +35,11 @@ export class DigitalSignatureScreenComponent {
//adjusted for chrome auto-complete / password manager //adjusted for chrome auto-complete / password manager
digitalSignature.password = digitalSignature.keySecret; digitalSignature.password = digitalSignature.keySecret;
this._digitalSignatureControllerService.saveDigitalSignature(digitalSignature).subscribe( const observable = this.digitalSignatureExists
? this._digitalSignatureControllerService.updateDigitalSignature(digitalSignature)
: this._digitalSignatureControllerService.saveDigitalSignature(digitalSignature);
observable.subscribe(
() => { () => {
this.loadDigitalSignatureAndInitializeForm(); this.loadDigitalSignatureAndInitializeForm();
this._notificationService.showToastNotification( this._notificationService.showToastNotification(
@ -105,6 +109,7 @@ export class DigitalSignatureScreenComponent {
this.digitalSignature = digitalSignature; this.digitalSignature = digitalSignature;
}, },
() => { () => {
this.digitalSignatureExists = false;
this.digitalSignature = {}; this.digitalSignature = {};
} }
) )
@ -119,14 +124,14 @@ export class DigitalSignatureScreenComponent {
certificateName: [this.digitalSignature.certificateName, Validators.required], certificateName: [this.digitalSignature.certificateName, Validators.required],
contactInfo: this.digitalSignature.contactInfo, contactInfo: this.digitalSignature.contactInfo,
location: this.digitalSignature.location, location: this.digitalSignature.location,
keySecret: [this.digitalSignature.password, Validators.required], keySecret: this.digitalSignatureExists ? null : [this.digitalSignature.password, Validators.required],
reason: this.digitalSignature.reason, reason: this.digitalSignature.reason,
base64EncodedPrivateKey: [this.digitalSignature.base64EncodedPrivateKey, Validators.required] base64EncodedPrivateKey: this.digitalSignatureExists ? null : [this.digitalSignature.base64EncodedPrivateKey, Validators.required]
}); });
} }
get hasDigitalSignatureSet() { get hasDigitalSignatureSet() {
return !!this.digitalSignatureForm.get('base64EncodedPrivateKey').value; return this.digitalSignatureExists || !!this.digitalSignatureForm.get('base64EncodedPrivateKey').value;
} }
formChanged() {} formChanged() {}

View File

@ -176,18 +176,10 @@ export class DigitalSignatureControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress. * @param reportProgress flag to report request and response progress.
*/ */
public saveDigitalSignature1(body: DigitalSignatureViewModel, observe?: 'body', reportProgress?: boolean): Observable<DigitalSignatureViewModel>; public updateDigitalSignature(body: DigitalSignatureViewModel, observe?: 'body', reportProgress?: boolean): Observable<any>;
public saveDigitalSignature1( public updateDigitalSignature(body: DigitalSignatureViewModel, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
body: DigitalSignatureViewModel, public updateDigitalSignature(body: DigitalSignatureViewModel, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
observe?: 'response', public updateDigitalSignature(body: DigitalSignatureViewModel, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
reportProgress?: boolean
): Observable<HttpResponse<DigitalSignatureViewModel>>;
public saveDigitalSignature1(
body: DigitalSignatureViewModel,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<DigitalSignatureViewModel>>;
public saveDigitalSignature1(body: DigitalSignatureViewModel, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (body === null || body === undefined) { if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling saveDigitalSignature1.'); throw new Error('Required parameter body was null or undefined when calling saveDigitalSignature1.');
} }
@ -214,7 +206,7 @@ export class DigitalSignatureControllerService {
headers = headers.set('Content-Type', httpContentTypeSelected); headers = headers.set('Content-Type', httpContentTypeSelected);
} }
return this.httpClient.request<DigitalSignatureViewModel>('put', `${this.basePath}/digital-signature`, { return this.httpClient.request<any>('put', `${this.basePath}/digital-signature`, {
body: body, body: body,
withCredentials: this.configuration.withCredentials, withCredentials: this.configuration.withCredentials,
headers: headers, headers: headers,