Fix default SSO config not filled in (#3479)

This commit is contained in:
Maurizio Vitale 2018-06-13 12:49:52 +01:00 committed by Eugenio Romano
parent 928340f65b
commit 427b8737ee
2 changed files with 3 additions and 12 deletions

View File

@ -242,7 +242,7 @@ export class UserPreferencesService {
if (this.storage.hasItem('authType')) { if (this.storage.hasItem('authType')) {
return this.storage.getItem('authType'); return this.storage.getItem('authType');
} else { } else {
return this.appConfig.get<string>('authType'); return this.appConfig.get<string>('authType', 'BASIC');
} }
} }

View File

@ -72,14 +72,9 @@ export class HostSettingsComponent implements OnInit {
let providerSelected = this.userPreference.providers; let providerSelected = this.userPreference.providers;
let authType = 'BASIC';
if (this.userPreference.authType === 'OAUTH') {
authType = this.userPreference.authType;
}
this.form = this.formBuilder.group({ this.form = this.formBuilder.group({
providersControl: [providerSelected, Validators.required], providersControl: [providerSelected, Validators.required],
authType: authType authType: this.userPreference.authType
}); });
this.addFormGroups(); this.addFormGroups();
@ -132,11 +127,7 @@ export class HostSettingsComponent implements OnInit {
} }
private createOAuthFormGroup(): AbstractControl { private createOAuthFormGroup(): AbstractControl {
let oAuthConfig: any = {}; const oAuthConfig: any = this.userPreference.oauthConfig ? this.userPreference.oauthConfig : {};
if (this.userPreference.authType === 'OAUTH') {
oAuthConfig = this.userPreference.oauthConfig;
}
return this.formBuilder.group({ return this.formBuilder.group({
host: [oAuthConfig.host, [Validators.required, Validators.pattern(this.HOST_REGEX)]], host: [oAuthConfig.host, [Validators.required, Validators.pattern(this.HOST_REGEX)]],
clientId: [oAuthConfig.clientId, Validators.required], clientId: [oAuthConfig.clientId, Validators.required],