Commit c5cc55156feda1ced2f1befb2ba93b6131ad8811
1 parent
f181beec
UI: Improvement used templated in OAuth2
Showing
1 changed file
with
9 additions
and
9 deletions
... | ... | @@ -142,6 +142,7 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha |
142 | 142 | tenantNamePattern = {value: null, disabled: true}; |
143 | 143 | } |
144 | 144 | const basicGroup = this.fb.group({ |
145 | + emailAttributeKey: [mapperConfigBasic?.emailAttributeKey ? mapperConfigBasic.emailAttributeKey : 'email', Validators.required], | |
145 | 146 | firstNameAttributeKey: [mapperConfigBasic?.firstNameAttributeKey ? mapperConfigBasic.firstNameAttributeKey : ''], |
146 | 147 | lastNameAttributeKey: [mapperConfigBasic?.lastNameAttributeKey ? mapperConfigBasic.lastNameAttributeKey : ''], |
147 | 148 | tenantNameStrategy: [mapperConfigBasic?.tenantNameStrategy ? mapperConfigBasic.tenantNameStrategy : TenantNameStrategy.DOMAIN], |
... | ... | @@ -151,11 +152,6 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha |
151 | 152 | alwaysFullScreen: [isDefinedAndNotNull(mapperConfigBasic?.alwaysFullScreen) ? mapperConfigBasic.alwaysFullScreen : false] |
152 | 153 | }); |
153 | 154 | |
154 | - if (MapperConfigType.GITHUB !== type) { | |
155 | - basicGroup.addControl('emailAttributeKey', | |
156 | - this.fb.control( mapperConfigBasic?.emailAttributeKey ? mapperConfigBasic.emailAttributeKey : 'email', Validators.required)); | |
157 | - } | |
158 | - | |
159 | 155 | this.subscriptions.push(basicGroup.get('tenantNameStrategy').valueChanges.subscribe((domain) => { |
160 | 156 | if (domain === 'CUSTOM') { |
161 | 157 | basicGroup.get('tenantNamePattern').enable(); |
... | ... | @@ -347,7 +343,7 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha |
347 | 343 | clientRegistration.get('authorizationUri').disable(); |
348 | 344 | clientRegistration.get('jwkSetUri').disable(); |
349 | 345 | clientRegistration.get('userInfoUri').disable(); |
350 | - clientRegistration.patchValue(template, {emitEvent: false}); | |
346 | + clientRegistration.patchValue(template); | |
351 | 347 | } |
352 | 348 | } |
353 | 349 | |
... | ... | @@ -358,11 +354,15 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha |
358 | 354 | mapperConfig.addControl('custom', this.formCustomGroup(predefinedValue?.custom)); |
359 | 355 | } else { |
360 | 356 | mapperConfig.removeControl('custom'); |
361 | - if (mapperConfig.get('basic')) { | |
362 | - mapperConfig.setControl('basic', this.formBasicGroup(type, predefinedValue?.basic)); | |
363 | - } else { | |
357 | + if (!mapperConfig.get('basic')) { | |
364 | 358 | mapperConfig.addControl('basic', this.formBasicGroup(type, predefinedValue?.basic)); |
365 | 359 | } |
360 | + if (type === MapperConfigType.GITHUB) { | |
361 | + mapperConfig.get('basic.emailAttributeKey').disable(); | |
362 | + mapperConfig.get('basic.emailAttributeKey').patchValue(null, {emitEvent: false}); | |
363 | + } else { | |
364 | + mapperConfig.get('basic.emailAttributeKey').enable(); | |
365 | + } | |
366 | 366 | } |
367 | 367 | } |
368 | 368 | ... | ... |