mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1873] Remove all deprecated code from ADF (#4145)
* remove deprecated code part 1 * remove deprecation step 2 * fix spellcheck * fix * fix lint * fix not used import * remove deprecation * fix test first part after remove deprecation * fix test * fix sidebar demo shell
This commit is contained in:
@@ -90,7 +90,6 @@ describe('LoginComponent', () => {
|
||||
});
|
||||
|
||||
function loginWithCredentials(username, password, providers: string = 'ECM') {
|
||||
component.providers = providers;
|
||||
usernameInput.value = username;
|
||||
passwordInput.value = password;
|
||||
|
||||
@@ -116,6 +115,8 @@ describe('LoginComponent', () => {
|
||||
});
|
||||
|
||||
it('should redirect to previous route state on successful login', () => {
|
||||
appConfigService.config.providers = 'ECM';
|
||||
|
||||
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
|
||||
const redirect = '/home';
|
||||
component.successRoute = redirect;
|
||||
@@ -393,7 +394,6 @@ describe('LoginComponent', () => {
|
||||
it('should return success event after the login have succeeded', (done) => {
|
||||
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
|
||||
|
||||
component.providers = 'ECM';
|
||||
expect(component.isError).toBe(false);
|
||||
|
||||
component.success.subscribe(() => {
|
||||
@@ -409,7 +409,6 @@ describe('LoginComponent', () => {
|
||||
});
|
||||
|
||||
it('should return error with a wrong username', (done) => {
|
||||
component.providers = 'ECM';
|
||||
|
||||
component.error.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -424,8 +423,6 @@ describe('LoginComponent', () => {
|
||||
});
|
||||
|
||||
it('should return error with a wrong password', (done) => {
|
||||
component.providers = 'ECM';
|
||||
|
||||
component.error.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -440,8 +437,6 @@ describe('LoginComponent', () => {
|
||||
});
|
||||
|
||||
it('should return error with a wrong username and password', (done) => {
|
||||
component.providers = 'ECM';
|
||||
|
||||
component.error.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -462,7 +457,6 @@ describe('LoginComponent', () => {
|
||||
message: 'ERROR: the network is offline, Origin is not allowed by Access-Control-Allow-Origin'
|
||||
}
|
||||
}));
|
||||
component.providers = 'ECM';
|
||||
|
||||
component.error.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -480,7 +474,6 @@ describe('LoginComponent', () => {
|
||||
it('should return CSRF error when server CSRF error occurs', async(() => {
|
||||
spyOn(authService, 'login')
|
||||
.and.returnValue(throwError({ message: 'ERROR: Invalid CSRF-token', status: 403 }));
|
||||
component.providers = 'ECM';
|
||||
|
||||
component.error.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -502,7 +495,6 @@ describe('LoginComponent', () => {
|
||||
status: 403
|
||||
}
|
||||
));
|
||||
component.providers = 'ECM';
|
||||
|
||||
component.error.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -516,8 +508,6 @@ describe('LoginComponent', () => {
|
||||
}));
|
||||
|
||||
it('should emit success event after the login has succeeded and discard password', async(() => {
|
||||
component.providers = 'ECM';
|
||||
|
||||
component.success.subscribe((event) => {
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -532,7 +522,6 @@ describe('LoginComponent', () => {
|
||||
|
||||
it('should emit error event after the login has failed', async(() => {
|
||||
spyOn(authService, 'login').and.returnValue(throwError('Fake server error'));
|
||||
component.providers = 'ECM';
|
||||
|
||||
component.error.subscribe((error) => {
|
||||
fixture.detectChanges();
|
||||
|
@@ -25,7 +25,6 @@ import { AuthenticationService } from '../../services/authentication.service';
|
||||
import { LogService } from '../../services/log.service';
|
||||
import { TranslationService } from '../../services/translation.service';
|
||||
import { UserPreferencesService } from '../../services/user-preferences.service';
|
||||
import { SettingsService } from '../../services/settings.service';
|
||||
|
||||
import { LoginErrorEvent } from '../models/login-error.event';
|
||||
import { LoginSubmitEvent } from '../models/login-submit.event';
|
||||
@@ -91,24 +90,10 @@ export class LoginComponent implements OnInit {
|
||||
@Input()
|
||||
copyrightText: string = '\u00A9 2016 Alfresco Software, Inc. All Rights Reserved.';
|
||||
|
||||
/**
|
||||
* Possible valid values are ECM, BPM or ALL.
|
||||
* @deprecated 3.0.0 - use the providers property in the the app.config.json
|
||||
*/
|
||||
@Input()
|
||||
providers: string;
|
||||
|
||||
/** Custom validation rules for the login form. */
|
||||
@Input()
|
||||
fieldsValidation: any;
|
||||
|
||||
/**
|
||||
* Prevents the CSRF Token from being submitted. Only valid for Alfresco Process Services.
|
||||
* @deprecated 3.0.0
|
||||
*/
|
||||
@Input()
|
||||
disableCsrf: boolean;
|
||||
|
||||
/** Route to redirect to on successful login. */
|
||||
@Input()
|
||||
successRoute: string = null;
|
||||
@@ -154,8 +139,7 @@ export class LoginComponent implements OnInit {
|
||||
private logService: LogService,
|
||||
private router: Router,
|
||||
private appConfig: AppConfigService,
|
||||
private userPreferences: UserPreferencesService,
|
||||
private settingsService: SettingsService
|
||||
private userPreferences: UserPreferencesService
|
||||
) {
|
||||
this.initFormError();
|
||||
this.initFormFieldsMessages();
|
||||
@@ -188,9 +172,6 @@ export class LoginComponent implements OnInit {
|
||||
* @param event
|
||||
*/
|
||||
onSubmit(values: any) {
|
||||
this.settingsService.setProviders(this.providers);
|
||||
this.settingsService.csrfDisabled = this.disableCsrf;
|
||||
|
||||
this.disableError();
|
||||
const args = new LoginSubmitEvent({
|
||||
controls: { username: this.form.controls.username }
|
||||
@@ -242,9 +223,7 @@ export class LoginComponent implements OnInit {
|
||||
.login(values.username, values.password, this.rememberMe)
|
||||
.subscribe(
|
||||
(token: any) => {
|
||||
const redirectUrl = this.authService.getRedirect(
|
||||
this.providers
|
||||
);
|
||||
const redirectUrl = this.authService.getRedirect();
|
||||
|
||||
this.actualLoginStep = LoginSteps.Welcome;
|
||||
this.userPreferences.setStoragePrefix(values.username);
|
||||
|
Reference in New Issue
Block a user