mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-14 09:32:43 +00:00
* privatelabeling refresh, org context color * chore(deps): bump @grpc/grpc-js from 1.6.10 to 1.7.0 in /console (#4358) Bumps [@grpc/grpc-js](https://github.com/grpc/grpc-node) from 1.6.10 to 1.7.0. - [Release notes](https://github.com/grpc/grpc-node/releases) - [Commits](https://github.com/grpc/grpc-node/compare/@grpc/grpc-js@1.6.10...@grpc/grpc-js@1.7.0) --- updated-dependencies: - dependency-name: "@grpc/grpc-js" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump ngx-color from 8.0.2 to 8.0.3 in /console (#4357) Bumps [ngx-color](https://github.com/scttcper/ngx-color) from 8.0.2 to 8.0.3. - [Release notes](https://github.com/scttcper/ngx-color/releases) - [Commits](https://github.com/scttcper/ngx-color/compare/v8.0.2...v8.0.3) --- updated-dependencies: - dependency-name: ngx-color dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @types/node from 17.0.45 to 18.7.16 in /console (#4341) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.45 to 18.7.16. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump jasmine-core from 4.2.0 to 4.4.0 in /console (#4317) Bumps [jasmine-core](https://github.com/jasmine/jasmine) from 4.2.0 to 4.4.0. - [Release notes](https://github.com/jasmine/jasmine/releases) - [Changelog](https://github.com/jasmine/jasmine/blob/main/RELEASE.md) - [Commits](https://github.com/jasmine/jasmine/compare/v4.2.0...v4.4.0) --- updated-dependencies: - dependency-name: jasmine-core dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @types/jasmine from 4.0.3 to 4.3.0 in /console (#4279) Bumps [@types/jasmine](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jasmine) from 4.0.3 to 4.3.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jasmine) --- updated-dependencies: - dependency-name: "@types/jasmine" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * quicklink * cli core * material cdk * eslint * add grantid * show oidc config error * use prettier config, linter * rm stylelint, fix lint * prettier - ignore proto output * labelling * update contribution guide Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Elio Bischof <eliobischof@gmail.com>
123 lines
4.0 KiB
TypeScript
123 lines
4.0 KiB
TypeScript
import { Component, Inject } from '@angular/core';
|
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
import { take } from 'rxjs/operators';
|
|
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
|
import { ToastService } from 'src/app/services/toast.service';
|
|
|
|
import { _arrayBufferToBase64 } from '../u2f_util';
|
|
|
|
export enum U2FComponentDestination {
|
|
MFA = 'mfa',
|
|
PASSWORDLESS = 'passwordless',
|
|
}
|
|
|
|
@Component({
|
|
selector: 'cnsl-dialog-u2f',
|
|
templateUrl: './dialog-u2f.component.html',
|
|
styleUrls: ['./dialog-u2f.component.scss'],
|
|
})
|
|
export class DialogU2FComponent {
|
|
private type!: U2FComponentDestination;
|
|
public name: string = '';
|
|
public error: string = '';
|
|
public loading: boolean = false;
|
|
|
|
constructor(
|
|
public dialogRef: MatDialogRef<DialogU2FComponent>,
|
|
@Inject(MAT_DIALOG_DATA) public data: { credOptions: any; type: U2FComponentDestination },
|
|
private service: GrpcAuthService,
|
|
private translate: TranslateService,
|
|
private toast: ToastService,
|
|
) {
|
|
this.type = data.type;
|
|
}
|
|
|
|
public closeDialog(): void {
|
|
this.dialogRef.close();
|
|
}
|
|
|
|
public closeDialogWithCode(): void {
|
|
this.error = '';
|
|
this.loading = true;
|
|
if (this.name && this.data.credOptions.publicKey) {
|
|
// this.data.credOptions.publicKey.rp.id = 'localhost';
|
|
navigator.credentials
|
|
.create(this.data.credOptions)
|
|
.then((resp) => {
|
|
if (
|
|
resp &&
|
|
(resp as any).response.attestationObject &&
|
|
(resp as any).response.clientDataJSON &&
|
|
(resp as any).rawId
|
|
) {
|
|
const attestationObject = (resp as any).response.attestationObject;
|
|
const clientDataJSON = (resp as any).response.clientDataJSON;
|
|
const rawId = (resp as any).rawId;
|
|
|
|
const data = JSON.stringify({
|
|
id: resp.id,
|
|
rawId: _arrayBufferToBase64(rawId),
|
|
type: resp.type,
|
|
response: {
|
|
attestationObject: _arrayBufferToBase64(attestationObject),
|
|
clientDataJSON: _arrayBufferToBase64(clientDataJSON),
|
|
},
|
|
});
|
|
|
|
const base64 = btoa(data);
|
|
if (this.type === U2FComponentDestination.MFA) {
|
|
this.service
|
|
.verifyMyMultiFactorU2F(base64, this.name)
|
|
.then(() => {
|
|
this.translate
|
|
.get('USER.MFA.U2F_SUCCESS')
|
|
.pipe(take(1))
|
|
.subscribe((msg) => {
|
|
this.toast.showInfo(msg);
|
|
});
|
|
this.dialogRef.close(true);
|
|
this.loading = false;
|
|
})
|
|
.catch((error) => {
|
|
this.loading = false;
|
|
this.toast.showError(error);
|
|
});
|
|
} else if (this.type === U2FComponentDestination.PASSWORDLESS) {
|
|
this.service
|
|
.verifyMyPasswordless(base64, this.name)
|
|
.then(() => {
|
|
this.translate
|
|
.get('USER.PASSWORDLESS.U2F_SUCCESS')
|
|
.pipe(take(1))
|
|
.subscribe((msg) => {
|
|
this.toast.showInfo(msg);
|
|
});
|
|
this.dialogRef.close(true);
|
|
this.loading = false;
|
|
})
|
|
.catch((error) => {
|
|
this.loading = false;
|
|
this.toast.showError(error);
|
|
});
|
|
}
|
|
} else {
|
|
this.loading = false;
|
|
this.translate
|
|
.get('USER.MFA.U2F_ERROR')
|
|
.pipe(take(1))
|
|
.subscribe((msg) => {
|
|
this.toast.showInfo(msg);
|
|
});
|
|
this.dialogRef.close(true);
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
this.loading = false;
|
|
this.error = error;
|
|
this.toast.showInfo(error.message);
|
|
});
|
|
}
|
|
}
|
|
}
|