Commit f73b05a82ad00a05ae39535810a9be7584d578d8
Committed by
GitHub
Merge pull request #3603 from vvlladd28/improvement/oauth2-template
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,6 +142,7 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha | ||
142 | tenantNamePattern = {value: null, disabled: true}; | 142 | tenantNamePattern = {value: null, disabled: true}; |
143 | } | 143 | } |
144 | const basicGroup = this.fb.group({ | 144 | const basicGroup = this.fb.group({ |
145 | + emailAttributeKey: [mapperConfigBasic?.emailAttributeKey ? mapperConfigBasic.emailAttributeKey : 'email', Validators.required], | ||
145 | firstNameAttributeKey: [mapperConfigBasic?.firstNameAttributeKey ? mapperConfigBasic.firstNameAttributeKey : ''], | 146 | firstNameAttributeKey: [mapperConfigBasic?.firstNameAttributeKey ? mapperConfigBasic.firstNameAttributeKey : ''], |
146 | lastNameAttributeKey: [mapperConfigBasic?.lastNameAttributeKey ? mapperConfigBasic.lastNameAttributeKey : ''], | 147 | lastNameAttributeKey: [mapperConfigBasic?.lastNameAttributeKey ? mapperConfigBasic.lastNameAttributeKey : ''], |
147 | tenantNameStrategy: [mapperConfigBasic?.tenantNameStrategy ? mapperConfigBasic.tenantNameStrategy : TenantNameStrategy.DOMAIN], | 148 | tenantNameStrategy: [mapperConfigBasic?.tenantNameStrategy ? mapperConfigBasic.tenantNameStrategy : TenantNameStrategy.DOMAIN], |
@@ -151,11 +152,6 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha | @@ -151,11 +152,6 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha | ||
151 | alwaysFullScreen: [isDefinedAndNotNull(mapperConfigBasic?.alwaysFullScreen) ? mapperConfigBasic.alwaysFullScreen : false] | 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 | this.subscriptions.push(basicGroup.get('tenantNameStrategy').valueChanges.subscribe((domain) => { | 155 | this.subscriptions.push(basicGroup.get('tenantNameStrategy').valueChanges.subscribe((domain) => { |
160 | if (domain === 'CUSTOM') { | 156 | if (domain === 'CUSTOM') { |
161 | basicGroup.get('tenantNamePattern').enable(); | 157 | basicGroup.get('tenantNamePattern').enable(); |
@@ -347,7 +343,7 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha | @@ -347,7 +343,7 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha | ||
347 | clientRegistration.get('authorizationUri').disable(); | 343 | clientRegistration.get('authorizationUri').disable(); |
348 | clientRegistration.get('jwkSetUri').disable(); | 344 | clientRegistration.get('jwkSetUri').disable(); |
349 | clientRegistration.get('userInfoUri').disable(); | 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,11 +354,15 @@ export class OAuth2SettingsComponent extends PageComponent implements OnInit, Ha | ||
358 | mapperConfig.addControl('custom', this.formCustomGroup(predefinedValue?.custom)); | 354 | mapperConfig.addControl('custom', this.formCustomGroup(predefinedValue?.custom)); |
359 | } else { | 355 | } else { |
360 | mapperConfig.removeControl('custom'); | 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 | mapperConfig.addControl('basic', this.formBasicGroup(type, predefinedValue?.basic)); | 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 |