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
@@ -137,7 +137,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
}
}).catch(error => {
console.error(error);
this.toast.showError(error.message);
this.toast.showError(error);
this.errorMessage = error.message;
});
}
@@ -145,15 +145,15 @@ export class AppDetailComponent implements OnInit, OnDestroy {
public changeState(event: MatButtonToggleChange): void {
if (event.value === AppState.APPSTATE_ACTIVE) {
this.projectService.ReactivateApplication(this.projectId, this.app.id).then(() => {
this.toast.showInfo('Reactivated Application');
this.toast.showInfo('APP.TOAST.REACTIVATED', true);
}).catch((error: any) => {
this.toast.showError(error.message);
this.toast.showError(error);
});
} else if (event.value === AppState.APPSTATE_INACTIVE) {
this.projectService.DeactivateApplication(this.projectId, this.app.id).then(() => {
this.toast.showInfo('Deactivated Application');
this.toast.showInfo('APP.TOAST.REACTIVATED', true);
}).catch((error: any) => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
@@ -222,7 +222,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
this.projectService
.UpdateOIDCAppConfig(this.projectId, this.app.id, this.app.oidcConfig)
.then((data: OIDCConfig) => {
this.toast.showInfo('OIDC Config saved');
this.toast.showInfo('APP.TOAST.OIDCUPDATED', true);
})
.catch(data => {
this.toast.showError(data.message);
@@ -233,7 +233,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
public regenerateOIDCClientSecret(): void {
this.projectService.RegenerateOIDCClientSecret(this.app.id, this.projectId).then((data: OIDCConfig) => {
this.toast.showInfo('OIDC Secret Regenerated');
this.toast.showInfo('APP.TOAST.OIDCCLIENTSECRETREGENERATED', true);
this.dialog.open(AppSecretDialogComponent, {
data: {
clientId: data.toObject().clientId,
@@ -91,9 +91,8 @@ export class GrantedProjectDetailComponent implements OnInit, OnDestroy {
if (this.projectId && this.grantId) {
this.projectService.GetGrantedProjectByID(this.projectId, this.grantId).then(proj => {
this.project = proj.toObject();
console.log(this.project);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -61,7 +61,7 @@ export class GrantedProjectGridComponent implements OnChanges {
}
public ngOnChanges(changes: SimpleChanges): void {
if (changes.items.currentValue && changes.items.currentValue.length > 0) {
if (changes.items?.currentValue && changes.items.currentValue.length > 0) {
this.notPinned = Object.assign([], this.items);
this.reorganizeItems();
}
@@ -95,7 +95,7 @@ export class GrantedProjectListComponent implements OnInit, OnDestroy {
this.loadingSubject.next(false);
}).catch(error => {
console.error(error);
this.toast.showError(error.message);
this.toast.showError(error);
this.loadingSubject.next(false);
});
}
@@ -1,8 +1,9 @@
<div class="wrapper">
<div class="header">
<img *ngIf="dark; else lighttheme" src="./assets/images/zitadel-logo-oneline-darkdesign.svg" />
<img alt="zitadel logo" *ngIf="dark; else lighttheme"
src="../assets/images/zitadel-logo-oneline-darkdesign.svg" />
<ng-template #lighttheme>
<img src="./assets/images/zitadel-logo-oneline-lightdesign.svg" />
<img alt="zitadel logo" src="../assets/images/zitadel-logo-oneline-lightdesign.svg" />
</ng-template>
</div>
@@ -79,4 +80,4 @@
</div>
</ng-template>
</div>
</div>
</div>
@@ -76,7 +76,7 @@ export class IamContributorsComponent implements OnInit {
})).then(() => {
this.toast.showError('members added');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -55,7 +55,7 @@ export class IamMembersComponent implements AfterViewInit {
return this.adminService.RemoveIamMember(member.userId).then(() => {
this.toast.showInfo('Removed successfully');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}));
}
@@ -64,7 +64,7 @@ export class IamMembersComponent implements AfterViewInit {
this.adminService.RemoveIamMember(member.userId).then(() => {
this.toast.showInfo('Member removed successfully');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
@@ -99,7 +99,7 @@ export class IamMembersComponent implements AfterViewInit {
})).then(() => {
this.toast.showError('members added');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -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);
});
});
}
@@ -82,7 +82,6 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
private async getData({ id }: Params): Promise<void> {
this.projectId = id;
console.log(this.projectId);
this.orgService.GetIam().then(iam => {
this.isZitadel = iam.toObject().iamProjectId === this.projectId;
@@ -93,7 +92,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
this.project = proj.toObject();
}).catch(error => {
console.error(error);
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -103,13 +102,13 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
this.projectService.ReactivateProject(this.projectId).then(() => {
this.toast.showInfo('Reactivated Project');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
} else if (newState === ProjectState.PROJECTSTATE_INACTIVE) {
this.projectService.DeactivateProject(this.projectId).then(() => {
this.toast.showInfo('Deactivated Project');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -1,5 +1,5 @@
<div class="view-toggle">
<button [disabled]="selection.selected.length > 0" (click)="changedView.emit(true)" mat-icon-button>
<button (click)="closeGridView()" mat-icon-button>
<i class="show list view las la-th-list"></i>
</button>
</div>
@@ -115,4 +115,8 @@ export class OwnedProjectGridComponent implements OnChanges {
this.router.navigate(['/projects', id]);
}
}
public closeGridView(): void {
this.changedView.emit(true);
}
}
@@ -95,7 +95,7 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy {
this.loadingSubject.next(false);
}).catch(error => {
console.error(error);
this.toast.showError(error.message);
this.toast.showError(error);
this.loadingSubject.next(false);
});
@@ -35,7 +35,6 @@ export class ProjectGrantDetailDataSource extends DataSource<ProjectMemberView.A
finalize(() => this.loadingSubject.next(false)),
).subscribe(members => {
this.membersSubject.next(members);
console.log(members);
});
}
@@ -25,8 +25,6 @@ export class ProjectGrantMembersDataSource extends DataSource<ProjectMember.AsOb
this.loadingSubject.next(true);
console.log(projectId, grantId);
from(this.projectService.SearchProjectGrantMembers(projectId,
grantId, pageSize, offset)).pipe(
map(resp => {
@@ -63,15 +63,14 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
if (this.type === ProjectType.PROJECTTYPE_GRANTED) {
this.projectService.GetProjectGrantMemberRoles().then(resp => {
this.memberRoleOptions = resp.toObject().rolesList;
console.log(this.memberRoleOptions);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
} else if (this.type === ProjectType.PROJECTTYPE_OWNED) {
this.projectService.GetProjectMemberRoles().then(resp => {
this.memberRoleOptions = resp.toObject().rolesList;
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -90,7 +89,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
return this.projectService.RemoveProjectGrantMember(this.projectId, this.grantId, member.userId).then(() => {
this.toast.showInfo('Removed successfully');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}));
}
@@ -99,7 +98,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
this.projectService.RemoveProjectGrantMember(this.projectId, this.grantId, member.userId).then(() => {
this.toast.showInfo('Member removed successfully');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
@@ -117,7 +116,6 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
public async openAddMember(): Promise<any> {
const keysList = (await this.projectService.GetProjectGrantMemberRoles()).toObject();
console.log(keysList);
const dialogRef = this.dialog.open(ProjectGrantMembersCreateDialogComponent, {
data: {
@@ -127,7 +125,6 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
});
dialogRef.afterClosed().subscribe((dataToAdd: ProjectGrantMembersCreateDialogExportType) => {
console.log(dataToAdd);
if (dataToAdd) {
dataToAdd.userIds.forEach((userid: string) => {
this.projectService.AddProjectGrantMember(
@@ -138,7 +135,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
).then(() => {
this.toast.showInfo('Project Grant Member successfully added!');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
});
@@ -147,13 +144,11 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
}
updateRoles(member: ProjectMember.AsObject, selectionChange: MatSelectChange): void {
console.log(this.projectId, this.grantId, member.userId, selectionChange.value);
this.projectService.ChangeProjectGrantMember(this.projectId, this.grantId, member.userId, selectionChange.value)
.then((newmember: ProjectMember) => {
console.log(newmember.toObject());
this.toast.showInfo('Member updated!');
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -43,20 +43,16 @@ export class ProjectGrantCreateComponent implements OnInit, OnDestroy {
}
public searchOrg(domain: string): void {
console.log(domain);
this.orgService.getOrgByDomainGlobal(domain).then((ret) => {
const tmp = ret.toObject();
console.log(ret.toObject());
this.authService.GetActiveOrg().then((org) => {
console.log(org);
if (tmp !== org) {
this.org = tmp;
}
});
this.org = ret.toObject();
console.log(this.org);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
@@ -71,7 +67,7 @@ export class ProjectGrantCreateComponent implements OnInit, OnDestroy {
this.close();
})
.catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
@@ -1,9 +1,10 @@
<div class="wrap">
<div class="block">
<div class="header">
<img *ngIf="dark; else lighttheme" src="./assets/images/zitadel-logo-oneline-darkdesign.svg" />
<img alt="zitadel logo" *ngIf="dark; else lighttheme"
src="../../../assets/images/zitadel-logo-oneline-darkdesign.svg" />
<ng-template #lighttheme>
<img src="./assets/images/zitadel-logo-oneline-lightdesign.svg" />
<img alt="zitadel logo" src="../../../assets/images/zitadel-logo-oneline-lightdesign.svg" />
</ng-template>
<p>{{'USER.SIGNEDOUT' | translate}}</p>
@@ -11,4 +12,4 @@
[routerLink]="[ '/users/me' ]">{{'USER.SIGNEDOUT_BTN' | translate}}</button>
</div>
</div>
</div>
</div>
@@ -86,7 +86,7 @@ export class UserCreateComponent implements OnDestroy {
this.userService
.CreateUser(this.user)
.then((data: User) => {
this.toast.showInfo('User created');
this.toast.showInfo('USER.TOAST.CREATED', true);
this.router.navigate(['users', data.getId()]);
})
.catch(data => {
@@ -21,8 +21,7 @@
</app-card>
<div class="col" *ngIf="user">
<app-card title="{{ 'USER.PROFILE.TITLE' | translate }}"
description="{{'USER.PROFILE.DESCRIPTION' | translate}}">
<app-card title="{{ 'USER.PROFILE.TITLE' | translate }}">
<app-detail-form [genders]="genders" [languages]="languages" [profile]="user"
(changedLanguage)="changedLanguage($event)" (submitData)="saveProfile($event)">
</app-detail-form>
@@ -66,7 +66,7 @@ export class AuthUserDetailComponent implements OnDestroy {
this.user.gender,
)
.then((data: UserProfile) => {
this.toast.showInfo('Saved Profile');
this.toast.showInfo('USER.TOAST.SAVED', true);
this.user = Object.assign(this.user, data.toObject());
})
.catch(data => {
@@ -79,7 +79,7 @@ export class AuthUserDetailComponent implements OnDestroy {
this.userService
.SaveMyUserEmail(this.user.email).then((data: UserEmail) => {
this.toast.showInfo('Saved Email');
this.toast.showInfo('USER.TOAST.EMAILSAVED', true);
this.user.email = data.toObject().email;
this.emailEditState = false;
}).catch(data => {
@@ -99,9 +99,9 @@ export class AuthUserDetailComponent implements OnDestroy {
dialogRef.afterClosed().subscribe(code => {
if (code) {
this.userService.VerifyMyUserPhone(code).then(() => {
this.toast.showInfo('Verified Phone');
this.toast.showInfo('USER.TOAST.PHONESAVED', true);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
});
@@ -113,7 +113,7 @@ export class AuthUserDetailComponent implements OnDestroy {
public resendVerification(): void {
this.userService.ResendEmailVerification().then(() => {
this.toast.showInfo('Saved Email');
this.toast.showInfo('USER.TOAST.EMAILSAVED', true);
}).catch(data => {
this.toast.showError(data.message);
});
@@ -121,7 +121,7 @@ export class AuthUserDetailComponent implements OnDestroy {
public resendPhoneVerification(): void {
this.userService.ResendPhoneVerification().then(() => {
this.toast.showInfo('Phoneverification was successfully sent!');
this.toast.showInfo('USER.TOAST.PHONEVERIFICATIONSENT', true);
}).catch(data => {
this.toast.showError(data.message);
});
@@ -129,7 +129,7 @@ export class AuthUserDetailComponent implements OnDestroy {
public deletePhone(): void {
this.userService.RemoveMyUserPhone().then(() => {
this.toast.showInfo('Phone removed with success!');
this.toast.showInfo('USER.TOAST.PHONEREMOVED', true);
this.user.phone = '';
this.phoneEditState = false;
}).catch(data => {
@@ -141,7 +141,7 @@ export class AuthUserDetailComponent implements OnDestroy {
this.phoneEditState = false;
this.userService
.SaveMyUserPhone(this.user.phone).then((data: UserPhone) => {
this.toast.showInfo('Saved Phone');
this.toast.showInfo('USER.TOAST.PHONESAVED', true);
this.user.phone = data.toObject().phone;
this.phoneEditState = false;
}).catch(data => {
@@ -154,7 +154,7 @@ export class AuthUserDetailComponent implements OnDestroy {
this.userService.GetMyUser().then(user => {
this.user = user.toObject();
}).catch(err => {
console.error(err);
this.toast.showError(err);
});
}
@@ -48,7 +48,7 @@ export class AuthUserMfaComponent implements OnInit, OnDestroy {
}
});
}, error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
@@ -64,7 +64,7 @@ export class AuthUserMfaComponent implements OnInit, OnDestroy {
public deleteMFA(type: MfaType): void {
if (type === MfaType.MFATYPE_OTP) {
this.userService.RemoveMfaOTP().then(() => {
this.toast.showInfo('OTP Deleted');
this.toast.showInfo('USER.TOAST.OTPREMOVED', true);
const index = this.mfaSubject.value.findIndex(mfa => mfa.type === type);
if (index > -1) {
@@ -74,7 +74,7 @@ export class AuthUserMfaComponent implements OnInit, OnDestroy {
}
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -1,10 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { PasswordComplexityPolicy } from 'src/app/proto/generated/management_pb';
import { PasswordComplexityPolicy } from 'src/app/proto/generated/auth_pb';
import { AuthUserService } from 'src/app/services/auth-user.service';
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
import { OrgService } from 'src/app/services/org.service';
import { ToastService } from 'src/app/services/toast.service';
import { lowerCaseValidator, numberValidator, symbolValidator, upperCaseValidator } from '../validators';
@@ -36,7 +35,6 @@ export class PasswordComponent implements OnInit {
public passwordForm!: FormGroup;
constructor(
private orgService: OrgService,
activatedRoute: ActivatedRoute,
private fb: FormBuilder,
private userService: AuthUserService,
@@ -51,7 +49,7 @@ export class PasswordComponent implements OnInit {
}
const validators: Validators[] = [Validators.required];
this.orgService.GetPasswordComplexityPolicy().then(complexity => {
this.userService.GetMyPasswordComplexityPolicy().then(complexity => {
this.policy = complexity.toObject();
if (this.policy.minLength) {
validators.push(Validators.minLength(this.policy.minLength));
@@ -97,7 +95,7 @@ export class PasswordComponent implements OnInit {
public setInitialPassword(userId: string): void {
if (this.passwordForm.valid && this.password && this.password.value) {
this.mgmtUserService.SetInitialPassword(userId, this.password.value).then((data: any) => {
this.toast.showInfo('Set initial Password');
this.toast.showInfo('USER.TOAST.INITIALPASSWORDSET', true);
window.history.back();
}).catch(data => {
this.toast.showError(data.message);
@@ -111,7 +109,7 @@ export class PasswordComponent implements OnInit {
this.newPassword && this.newPassword.value && this.newPassword.valid) {
this.userService
.ChangeMyPassword(this.currentPassword.value, this.newPassword.value).then((data: any) => {
this.toast.showInfo('Password Set');
this.toast.showInfo('USER.TOAST.PASSWORDCHANGED', true);
window.history.back();
}).catch(data => {
this.toast.showError(data.message);
@@ -16,8 +16,6 @@
class="state-button"
(click)="changeState(UserState.USERSTATE_ACTIVE)">{{'USER.PAGES.REACTIVATE' | translate}}</button>
</ng-template>
<p class="desc">{{ 'USER.PROFILE.DESCRIPTION' | translate }}</p>
</div>
<mat-progress-bar *ngIf="loading" color="accent" mode="indeterminate"></mat-progress-bar>
@@ -3,23 +3,18 @@
align-items: center;
border-bottom: 1px solid #ffffff20;
flex-wrap: wrap;
padding-bottom: .5rem;
a {
display: block;
margin-right: 2rem;
}
h1 {
font-size: 2rem;
margin: 0 1rem;
margin-left: 2rem;
margin: 0;
font-weight: normal;
}
.desc {
width: 100%;
display: block;
font-size: .9rem;
color: #8795a1;
margin-right: 1rem;
}
.fill-space {
@@ -65,15 +65,15 @@ export class UserDetailComponent implements OnInit, OnDestroy {
public changeState(newState: UserState): void {
if (newState === UserState.USERSTATE_ACTIVE) {
this.mgmtUserService.ReactivateUser(this.user.id).then(() => {
this.toast.showInfo('reactivated User');
this.toast.showInfo('USER.TOAST.REACTIVATED', true);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
} else if (newState === UserState.USERSTATE_INACTIVE) {
this.mgmtUserService.DeactivateUser(this.user.id).then(() => {
this.toast.showInfo('deactivated User');
this.toast.showInfo('USER.TOAST.DEACTIVATED', true);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
}
}
@@ -94,7 +94,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
this.user.preferredLanguage,
this.user.gender)
.then((data: UserProfile) => {
this.toast.showInfo('Saved Profile');
this.toast.showInfo('USER.TOAST.SAVED', true);
this.user = Object.assign(this.user, data.toObject());
})
.catch(data => {
@@ -104,7 +104,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
public resendVerification(): void {
this.mgmtUserService.ResendEmailVerification(this.user.id).then(() => {
this.toast.showInfo('Email was successfully sent!');
this.toast.showInfo('USER.TOAST.EMAILVERIFICATIONSENT', true);
}).catch(data => {
this.toast.showError(data.message);
});
@@ -112,7 +112,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
public resendPhoneVerification(): void {
this.mgmtUserService.ResendPhoneVerification(this.user.id).then(() => {
this.toast.showInfo('Phoneverification was successfully sent!');
this.toast.showInfo('USER.TOAST.PHONEVERIFICATIONSENT', true);
}).catch(data => {
this.toast.showError(data.message);
});
@@ -120,7 +120,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
public deletePhone(): void {
this.mgmtUserService.RemoveUserPhone(this.user.id).then(() => {
this.toast.showInfo('Phone removed with success!');
this.toast.showInfo('USER.TOAST.PHONEREMOVED', true);
this.user.phone = '';
this.phoneEditState = false;
}).catch(data => {
@@ -132,7 +132,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
this.emailEditState = false;
this.mgmtUserService
.SaveUserEmail(this.user.id, this.user.email).then((data: UserEmail) => {
this.toast.showInfo('Saved Email');
this.toast.showInfo('USER.TOAST.EMAILSENT', true);
this.user.email = data.toObject().email;
}).catch(data => {
this.toast.showError(data.message);
@@ -143,7 +143,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
this.phoneEditState = false;
this.mgmtUserService
.SaveUserPhone(this.user.id, this.user.phone).then((data: UserPhone) => {
this.toast.showInfo('Saved Phone');
this.toast.showInfo('USER.TOAST.PHONESAVED', true);
this.user.phone = data.toObject().phone;
this.phoneEditState = false;
}).catch(data => {
@@ -167,7 +167,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
public sendSetPasswordNotification(): void {
this.mgmtUserService.SendSetPasswordNotification(this.user.id, NotificationType.NOTIFICATIONTYPE_EMAIL)
.then(() => {
this.toast.showInfo('Set initial Password');
this.toast.showInfo('USER.TOAST.PASSWORDNOTIFICATIONSENT', true);
}).catch(data => {
this.toast.showError(data.message);
});
@@ -39,7 +39,6 @@ export class UserGrantCreateComponent implements OnDestroy {
private route: ActivatedRoute,
) {
this.subscription = this.route.params.subscribe((params: Params) => {
console.log(params);
const { context, projectid, grantid, userid } = params;
this.context = context;
@@ -76,7 +75,7 @@ export class UserGrantCreateComponent implements OnDestroy {
this.toast.showInfo('User Grant added');
this.close();
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
case UserGrantContext.OWNED_PROJECT:
@@ -88,7 +87,7 @@ export class UserGrantCreateComponent implements OnDestroy {
this.toast.showInfo('Project User Grant added');
this.close();
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
case UserGrantContext.GRANTED_PROJECT:
@@ -102,7 +101,7 @@ export class UserGrantCreateComponent implements OnDestroy {
this.toast.showInfo('Project Grant User Grant added');
this.close();
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
});
break;
@@ -111,12 +110,10 @@ export class UserGrantCreateComponent implements OnDestroy {
}
public selectProject(project: ProjectView.AsObject | ProjectGrantView.AsObject | any): void {
console.log(project);
this.projectId = project.projectId;
}
public selectUser(user: User.AsObject): void {
console.log(user);
this.userId = user.id;
}
@@ -79,7 +79,7 @@ export class UserListComponent implements OnDestroy {
this.dataSource.data = resp.toObject().resultList;
this.loadingSubject.next(false);
}).catch(error => {
this.toast.showError(error.message);
this.toast.showError(error);
this.loadingSubject.next(false);
});
}