-
Note: Prefer urls like "
https://example.com/my-secure-image.png" instead
- of "http://example.com/my-image.png".
+
+ Note: Prefer urls like "https://example.com/my-secure-image.png"
+ instead of "http://example.com/my-image.png".
Browsers may not load non secure content.
@@ -112,6 +112,7 @@ export class EditStakeholderComponent implements OnDestroy {
@Input()
public disableAlias: boolean = false;
public stakeholderFb: FormGroup;
+ public secure: boolean = false;
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
public defaultStakeholdersOptions: Option[];
public defaultStakeholders: Stakeholder[];
@@ -173,8 +174,28 @@ export class EditStakeholderComponent implements OnDestroy {
type: this.fb.control(this.stakeholder.type, Validators.required),
topics: this.fb.control(this.stakeholder.topics),
isUpload: this.fb.control(this.stakeholder.isUpload),
- logoUrl: this.fb.control(this.stakeholder.logoUrl, StringUtils.urlValidator()),
+ logoUrl: this.fb.control(this.stakeholder.logoUrl),
});
+ if (this.stakeholder.isUpload) {
+ this.stakeholderFb.get('logoUrl').clearValidators();
+ this.stakeholderFb.get('logoUrl').updateValueAndValidity();
+ } else {
+ this.stakeholderFb.get('logoUrl').setValidators([StringUtils.urlValidator()]);
+ this.stakeholderFb.get('logoUrl').updateValueAndValidity();
+ }
+ this.subscriptions.push(this.stakeholderFb.get('isUpload').valueChanges.subscribe(value => {
+ if (value == true) {
+ this.stakeholderFb.get('logoUrl').clearValidators();
+ this.stakeholderFb.updateValueAndValidity();
+ } else {
+ this.stakeholderFb.get('logoUrl').setValidators([StringUtils.urlValidator()]);
+ this.stakeholderFb.updateValueAndValidity();
+ }
+ }));
+ this.secure = (!this.stakeholderFb.get('logoUrl').value || this.stakeholderFb.get('logoUrl').value.includes('https://'));
+ this.subscriptions.push(this.stakeholderFb.get('logoUrl').valueChanges.subscribe(value => {
+ this.secure = (!value || value.includes('https://'));
+ }));
this.initPhoto();
if (!isDefault) {
this.subscriptions.push(this.stakeholderFb.get('type').valueChanges.subscribe(value => {
@@ -362,7 +383,7 @@ export class EditStakeholderComponent implements OnDestroy {
this.stakeholderFb.get('isUpload').setValue(false);
this.stakeholderFb.get('isUpload').markAsDirty();
this.removePhoto();
- this.stakeholderFb.setControl('logoUrl', this.fb.control(null));
+ this.stakeholderFb.get('logoUrl').setValue(null);
if (this.stakeholder.isUpload) {
this.deleteCurrentPhoto = true;
}
diff --git a/src/app/topic/indicators.component.html b/src/app/topic/indicators.component.html
index f015c5f..7909f4d 100644
--- a/src/app/topic/indicators.component.html
+++ b/src/app/topic/indicators.component.html
@@ -296,7 +296,7 @@