mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
move settings in another page and hide the bar if you are not logged in #908
This commit is contained in:
@@ -37,6 +37,9 @@ export class LoginDemoComponent implements OnInit {
|
||||
blackListUsername: string;
|
||||
customValidation: any;
|
||||
|
||||
isECM: boolean = true;
|
||||
isBPM: boolean = false;
|
||||
|
||||
constructor(public router: Router) {
|
||||
this.customValidation = {
|
||||
username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],
|
||||
@@ -48,6 +51,25 @@ export class LoginDemoComponent implements OnInit {
|
||||
this.alfrescologin.addCustomValidationError('username', 'required', 'LOGIN.MESSAGES.USERNAME-REQUIRED');
|
||||
this.alfrescologin.addCustomValidationError('username', 'minlength', 'LOGIN.MESSAGES.USERNAME-MIN');
|
||||
this.alfrescologin.addCustomValidationError('password', 'required', 'LOGIN.MESSAGES.PASSWORD-REQUIRED');
|
||||
|
||||
if (localStorage.getItem('providers')) {
|
||||
this.providers = localStorage.getItem('providers');
|
||||
}
|
||||
|
||||
this.setProviders();
|
||||
}
|
||||
|
||||
setProviders() {
|
||||
if (this.providers === 'BPM') {
|
||||
this.isECM = false;
|
||||
this.isBPM = true;
|
||||
} else if (this.providers == 'ECM') {
|
||||
this.isECM = true;
|
||||
this.isBPM = false;
|
||||
} else if (this.providers === 'ALL') {
|
||||
this.isECM = true;
|
||||
this.isBPM = true;
|
||||
}
|
||||
}
|
||||
|
||||
onLogin($event) {
|
||||
@@ -66,9 +88,9 @@ export class LoginDemoComponent implements OnInit {
|
||||
this.providers = 'ECM';
|
||||
} else if (!checked && this.providers === 'ALL') {
|
||||
this.providers = 'BPM';
|
||||
} else {
|
||||
this.providers = undefined;
|
||||
}
|
||||
|
||||
localStorage.setItem('providers', this.providers);
|
||||
}
|
||||
|
||||
toggleBPM(checked) {
|
||||
@@ -78,9 +100,9 @@ export class LoginDemoComponent implements OnInit {
|
||||
this.providers = 'BPM';
|
||||
} else if (!checked && this.providers === 'ALL') {
|
||||
this.providers = 'ECM';
|
||||
} else {
|
||||
this.providers = undefined;
|
||||
}
|
||||
|
||||
localStorage.setItem('providers', this.providers);
|
||||
}
|
||||
|
||||
toggleCSRF() {
|
||||
@@ -89,7 +111,7 @@ export class LoginDemoComponent implements OnInit {
|
||||
|
||||
validateForm(event: any) {
|
||||
let values = event.values;
|
||||
if (values.controls['username'].value === this.blackListUsername ) {
|
||||
if (values.controls['username'].value === this.blackListUsername) {
|
||||
this.alfrescologin.addCustomFormError('username', 'This particular username has been blocked');
|
||||
event.preventDefault();
|
||||
}
|
||||
|
Reference in New Issue
Block a user