fix(console): toast login handler, show user session loginname, policy value incrementation, accessibility (#413)

* get auth policy, fix increment from 0

* seo, accessibility

* ngsw rem check for update

* organize interceptors

* toast i18n part1

* show loginname

* use primary color

* toast login handler, fix user session type

* Update console/src/assets/i18n/de.json

Co-authored-by: Florian Forster <[email protected]>

* Update console/src/assets/i18n/de.json

Co-authored-by: Florian Forster <[email protected]>

* Update console/src/assets/i18n/de.json

Co-authored-by: Florian Forster <[email protected]>

* Update console/src/assets/i18n/en.json

Co-authored-by: Florian Forster <[email protected]>

* Update console/src/index.html

Co-authored-by: Florian Forster <[email protected]>

* Update console/src/assets/i18n/en.json

Co-authored-by: Florian Forster <[email protected]>

* Update console/src/assets/i18n/en.json

Co-authored-by: Florian Forster <[email protected]>

Co-authored-by: Florian Forster <[email protected]>
This commit is contained in:
Max Peintner
2020-07-09 10:54:55 +02:00
committed by GitHub
co-authored by Florian Forster
parent fa57cc48c1
commit 0721acf605
69 changed files with 796 additions and 675 deletions
@@ -77,7 +77,7 @@ export class OrgContributorsComponent implements OnInit {
})).then(() => {
this.toast.showError('members added');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -4,9 +4,9 @@ import { Component } from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { CreateOrgRequest, CreateUserRequest, Gender, OrgSetUpResponse } from 'src/app/proto/generated/admin_pb';
import { PasswordComplexityPolicy } from 'src/app/proto/generated/management_pb';
import { PasswordComplexityPolicy } from 'src/app/proto/generated/auth_pb';
import { AdminService } from 'src/app/services/admin.service';
import { OrgService } from 'src/app/services/org.service';
import { AuthUserService } from 'src/app/services/auth-user.service';
import { ToastService } from 'src/app/services/toast.service';
import { lowerCaseValidator, numberValidator, symbolValidator, upperCaseValidator } from '../../user-detail/validators';
@@ -62,7 +62,7 @@ export class OrgCreateComponent {
private adminService: AdminService,
private _location: Location,
private fb: FormBuilder,
private orgService: OrgService,
private authUserService: AuthUserService,
) {
const validators: Validators[] = [Validators.required];
@@ -70,7 +70,7 @@ export class OrgCreateComponent {
name: ['', [Validators.required]],
domain: [''],
});
this.orgService.GetPasswordComplexityPolicy().then(data => {
this.authUserService.GetMyPasswordComplexityPolicy().then(data => {
this.policy = data.toObject();
if (this.policy.minLength) {
validators.push(Validators.minLength(this.policy.minLength));
@@ -52,7 +52,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
this.orgService.GetMyOrg().then((org: Org) => {
this.org = org.toObject();
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
this.orgService.SearchMyOrgDomains(0, 100).then(result => {
@@ -66,13 +66,13 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
this.orgService.ReactivateMyOrg().then(() => {
this.toast.showInfo('Reactivated Org');
}).catch((error) => {
this.toast.showError(error.message);
this.toast.showError(error);
});
} else if (event.value === OrgState.ORGSTATE_INACTIVE) {
this.orgService.DeactivateMyOrg().then(() => {
this.toast.showInfo('Deactivated Org');
}).catch((error) => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -104,7 +104,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
this.domains.splice(index, 1);
}
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
});
@@ -33,7 +33,7 @@ export class OrgGridComponent {
this.orgList = res.toObject().resultList;
}).catch(error => {
console.error(error);
this.toast.showError(error.message);
this.toast.showError(error);
});
}
@@ -22,7 +22,7 @@ export class OrgMemberRolesAutocompleteComponent {
this.orgService.GetOrgMemberRoles().then(resp => {
this.allRoles = resp.toObject().rolesList;
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
this.myControl.valueChanges.subscribe(change => {
@@ -59,7 +59,7 @@ export class OrgMembersComponent implements AfterViewInit {
return this.orgService.RemoveMyOrgMember(member.userId).then(() => {
this.toast.showInfo('Removed successfully');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}));
}
@@ -68,7 +68,7 @@ export class OrgMembersComponent implements AfterViewInit {
this.orgService.RemoveMyOrgMember(member.userId).then(() => {
this.toast.showInfo('Member removed successfully');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
@@ -103,7 +103,7 @@ export class OrgMembersComponent implements AfterViewInit {
})).then(() => {
this.toast.showError('members added');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -35,7 +35,7 @@
<div class="row">
<span class="left-desc">{{'ORG.POLICY.DATA.SHOWLOCKOUTFAILURES' | translate}}</span>
<span class="fill-space"></span>
<mat-slide-toggle name="showLockOutFailures" ngDefaultControl
<mat-slide-toggle color="primary" name="showLockOutFailures" ngDefaultControl
[(ngModel)]="complexityData.showLockOutFailures">
</mat-slide-toggle>
</div>
@@ -63,26 +63,28 @@
<div class="row">
<span class="left-desc">{{'ORG.POLICY.DATA.HASNUMBER' | translate}}</span>
<span class="fill-space"></span>
<mat-slide-toggle name="hasNumber" ngDefaultControl [(ngModel)]="complexityData.hasNumber">
<mat-slide-toggle color="primary" name="hasNumber" ngDefaultControl
[(ngModel)]="complexityData.hasNumber">
</mat-slide-toggle>
</div>
<div class="row">
<span class="left-desc">{{'ORG.POLICY.DATA.HASSYMBOL' | translate}}</span>
<span class="fill-space"></span>
<mat-slide-toggle name="hasSymbol" ngDefaultControl [(ngModel)]="complexityData.hasSymbol">
<mat-slide-toggle color="primary" name="hasSymbol" ngDefaultControl
[(ngModel)]="complexityData.hasSymbol">
</mat-slide-toggle>
</div>
<div class="row">
<span class="left-desc">{{'ORG.POLICY.DATA.HASLOWERCASE' | translate}}</span>
<span class="fill-space"></span>
<mat-slide-toggle name="hasLowercase" ngDefaultControl
<mat-slide-toggle color="primary" name="hasLowercase" ngDefaultControl
[(ngModel)]="complexityData.hasLowercase">
</mat-slide-toggle>
</div>
<div class="row">
<span class="left-desc">{{'ORG.POLICY.DATA.HASUPPERCASE' | translate}}</span>
<span class="fill-space"></span>
<mat-slide-toggle name="hasUppercase" ngDefaultControl
<mat-slide-toggle color="primary" name="hasUppercase" ngDefaultControl
[(ngModel)]="complexityData.hasUppercase">
</mat-slide-toggle>
</div>
@@ -132,13 +134,14 @@
<div class="row">
<span class="left-desc">{{'ORG.POLICY.DATA.USERLOGINMUSTBEDOMAIN' | translate}}</span>
<span class="fill-space"></span>
<mat-slide-toggle name="hasNumber" ngDefaultControl [(ngModel)]="iamData.userLoginMustBeDomain">
<mat-slide-toggle color="primary" name="hasNumber" ngDefaultControl
[(ngModel)]="iamData.userLoginMustBeDomain">
</mat-slide-toggle>
</div>
</div>
<div class="btn-container">
<button (click)="savePolicy()" color="accent" type="submit"
<button (click)="savePolicy()" color="primary" type="submit"
mat-raised-button>{{ 'ACTIONS.SAVE' | translate }}</button>
</div>
</div>
@@ -160,7 +160,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
}
public incrementLength(): void {
if (this.complexityData?.minLength) {
if (this.complexityData?.minLength !== undefined) {
this.complexityData.minLength++;
}
}
@@ -172,7 +172,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
}
public incrementMaxAttempts(): void {
if (this.lockoutData?.maxAttempts) {
if (this.lockoutData?.maxAttempts !== undefined) {
this.lockoutData.maxAttempts++;
}
}
@@ -184,7 +184,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
}
public incrementExpireWarnDays(): void {
if (this.ageData?.expireWarnDays) {
if (this.ageData?.expireWarnDays !== undefined) {
this.ageData.expireWarnDays++;
}
}
@@ -196,7 +196,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
}
public incrementMaxAgeDays(): void {
if (this.ageData?.maxAgeDays) {
if (this.ageData?.maxAgeDays !== undefined) {
this.ageData.maxAgeDays++;
}
}
@@ -218,7 +218,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
).then(() => {
this.router.navigate(['org']);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
@@ -230,7 +230,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
).then(() => {
this.router.navigate(['org']);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
@@ -245,7 +245,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
).then(() => {
this.router.navigate(['org']);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
@@ -259,7 +259,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
).then(() => {
this.router.navigate(['org']);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
break;
@@ -274,7 +274,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
).then(() => {
this.router.navigate(['org']);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
@@ -286,7 +286,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
).then(() => {
this.router.navigate(['org']);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
@@ -301,7 +301,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
).then(() => {
this.router.navigate(['org']);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
@@ -315,7 +315,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
).then(() => {
this.router.navigate(['org']);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
break;
@@ -54,21 +54,21 @@ export class PolicyGridComponent implements OnInit {
this.orgService.DeletePasswordLockoutPolicy(this.lockoutPolicy.id).then(() => {
this.toast.showInfo('Successfully deleted');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
case PolicyComponentType.AGE:
this.orgService.DeletePasswordAgePolicy(this.agePolicy.id).then(() => {
this.toast.showInfo('Successfully deleted');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
case PolicyComponentType.COMPLEXITY:
this.orgService.DeletePasswordLockoutPolicy(this.lockoutPolicy.id).then(() => {
this.toast.showInfo('Successfully deleted');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
}
@@ -36,7 +36,6 @@ export class SearchOrgAutocompleteComponent {
}
}).catch(error => {
this.isLoading = false;
// this.toast.showInfo(error.message);
});
});
}