diff --git a/lib/core/services/user-preferences.service.ts b/lib/core/services/user-preferences.service.ts index f494fbe809..583a8a17a3 100644 --- a/lib/core/services/user-preferences.service.ts +++ b/lib/core/services/user-preferences.service.ts @@ -242,7 +242,7 @@ export class UserPreferencesService { if (this.storage.hasItem('authType')) { return this.storage.getItem('authType'); } else { - return this.appConfig.get('authType'); + return this.appConfig.get('authType', 'BASIC'); } } diff --git a/lib/core/settings/host-settings.component.ts b/lib/core/settings/host-settings.component.ts index 54b9ad7c59..c30e56ee9d 100644 --- a/lib/core/settings/host-settings.component.ts +++ b/lib/core/settings/host-settings.component.ts @@ -72,14 +72,9 @@ export class HostSettingsComponent implements OnInit { let providerSelected = this.userPreference.providers; - let authType = 'BASIC'; - if (this.userPreference.authType === 'OAUTH') { - authType = this.userPreference.authType; - } - this.form = this.formBuilder.group({ providersControl: [providerSelected, Validators.required], - authType: authType + authType: this.userPreference.authType }); this.addFormGroups(); @@ -132,11 +127,7 @@ export class HostSettingsComponent implements OnInit { } private createOAuthFormGroup(): AbstractControl { - let oAuthConfig: any = {}; - if (this.userPreference.authType === 'OAUTH') { - oAuthConfig = this.userPreference.oauthConfig; - } - + const oAuthConfig: any = this.userPreference.oauthConfig ? this.userPreference.oauthConfig : {}; return this.formBuilder.group({ host: [oAuthConfig.host, [Validators.required, Validators.pattern(this.HOST_REGEX)]], clientId: [oAuthConfig.clientId, Validators.required],