[ADF-3191] Not able to login only to BPM or ECM (#3478)

* disable random test

* host setting component reset JS-API

* reload api after user prefrence change

* remove replicate reset

* missing semicolon

* deprecate provider property

* remove trailing space

* check new value before to set
This commit is contained in:
Eugenio Romano
2018-06-13 16:05:35 +01:00
committed by GitHub
parent d41e3d5b9c
commit afdedf02d1
12 changed files with 68 additions and 139 deletions

View File

@@ -16,21 +16,14 @@
*/
import {
Component,
ElementRef,
EventEmitter,
Input,
OnInit,
Output,
TemplateRef,
ViewEncapsulation
Component, ElementRef, EventEmitter, Input, OnInit,
Output, TemplateRef, ViewEncapsulation
} from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { AuthenticationService } from '../../services/authentication.service';
import { LogService } from '../../services/log.service';
import { SettingsService } from '../../services/settings.service';
import { TranslationService } from '../../services/translation.service';
import { UserPreferencesService } from '../../services/user-preferences.service';
@@ -90,8 +83,9 @@ export class LoginComponent implements OnInit {
@Input()
copyrightText: string = '\u00A9 2016 Alfresco Software, Inc. All Rights Reserved.';
/** Possible valid values are ECM, BPM or ALL. By default, this component
* will log in only to ECM. If you want to log in in both systems then use ALL.
/** Possible valid values are ECM, BPM or ALL.
* deprecated in 2.4.0 use the providers property in the the app.config.json
* @deprecated 2.4.0
*/
@Input()
providers: string;
@@ -140,12 +134,10 @@ export class LoginComponent implements OnInit {
* Constructor
* @param _fb
* @param authService
* @param settingsService
* @param translate
*/
constructor(private _fb: FormBuilder,
private authService: AuthenticationService,
private settingsService: SettingsService,
private translateService: TranslationService,
private logService: LogService,
private elementRef: ElementRef,
@@ -177,14 +169,10 @@ export class LoginComponent implements OnInit {
* @param event
*/
onSubmit(values: any) {
if (!this.checkRequiredParams()) {
return false;
if (this.disableCsrf !== null && this.disableCsrf !== undefined) {
this.userPreferences.disableCSRF = this.disableCsrf;
}
this.settingsService.setProviders(this.providers);
this.settingsService.csrfDisabled = this.disableCsrf;
this.disableError();
const args = new LoginSubmitEvent({ controls: { username: this.form.controls.username } });
this.executeSubmit.emit(args);
@@ -272,25 +260,6 @@ export class LoginComponent implements OnInit {
}
}
/**
* Check the require parameter
*/
private checkRequiredParams(): boolean {
let isAllParamPresent: boolean = true;
if (this.providers === undefined || this.providers === null || this.providers === '') {
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-PROVIDERS';
this.enableError();
let messageProviders: any;
messageProviders = this.translateService.get(this.errorMsg);
this.error.emit(new LoginErrorEvent(messageProviders.value));
isAllParamPresent = false;
}
return isAllParamPresent;
}
/**
* Add a custom form error for a field
* @param field