two factor duo component migration

This commit is contained in:
vinith-kovan 2024-06-10 19:38:28 +05:30
parent 09d45ed24f
commit fe12339f1c
No known key found for this signature in database
GPG Key ID: 9E663946A0AE5089
3 changed files with 11 additions and 18 deletions

View File

@ -10,9 +10,9 @@
{{ "twoStepLoginProviderEnabled" | i18n }}
</app-callout>
<img class="tw-float-right tw-ml-3 mfaType2" alt="Duo logo" />
<strong>{{ "twoFactorDuoIntegrationKey" | i18n }}:</strong> {{ ikey }}
<strong>{{ "twoFactorDuoClientId" | i18n }}:</strong> {{ ikey }}
<br />
<strong>{{ "twoFactorDuoSecretKey" | i18n }}:</strong> {{ skey }}
<strong>{{ "twoFactorDuoClientSecret" | i18n }}:</strong> {{ skey }}
<br />
<strong>{{ "twoFactorDuoApiHostname" | i18n }}:</strong> {{ host }}
</ng-container>
@ -20,11 +20,11 @@
<img class="tw-float-right tw-ml-3 mfaType2" alt="Duo logo" />
<p bitTypography="body1">{{ "twoFactorDuoDesc" | i18n }}</p>
<bit-form-field>
<bit-label>{{ "twoFactorDuoIntegrationKey" | i18n }}</bit-label>
<bit-label>{{ "twoFactorDuoClientId" | i18n }}</bit-label>
<input bitInput type="text" formControlName="ikey" appInputVerbatim />
</bit-form-field>
<bit-form-field>
<bit-label>{{ "twoFactorDuoSecretKey" | i18n }}</bit-label>
<bit-label>{{ "twoFactorDuoClientSecret" | i18n }}</bit-label>
<input
bitInput
type="password"

View File

@ -22,8 +22,6 @@ import { TwoFactorBaseComponent } from "./two-factor-base.component";
export class TwoFactorDuoComponent extends TwoFactorBaseComponent {
@Output() onChangeStatus: EventEmitter<boolean> = new EventEmitter();
type = TwoFactorProviderType.Duo;
clientId: string;
clientSecret: string;
formPromise: Promise<TwoFactorDuoResponse>;
formGroup = this.formBuilder.group({
ikey: ["", [Validators.required]],
@ -97,8 +95,8 @@ export class TwoFactorDuoComponent extends TwoFactorBaseComponent {
protected async enable() {
const request = await this.buildRequestModel(UpdateTwoFactorDuoRequest);
request.integrationKey = this.clientId;
request.secretKey = this.clientSecret;
request.integrationKey = this.ikey;
request.secretKey = this.skey;
request.host = this.host;
return super.enable(async () => {
@ -118,8 +116,8 @@ export class TwoFactorDuoComponent extends TwoFactorBaseComponent {
this.dialogRef.close(this.enabled);
};
private processResponse(response: TwoFactorDuoResponse) {
this.clientId = response.integrationKey;
this.clientSecret = response.secretKey;
this.ikey = response.integrationKey;
this.skey = response.secretKey;
this.host = response.host;
this.enabled = response.enabled;
}

View File

@ -163,17 +163,12 @@ export class TwoFactorSetupComponent implements OnInit, OnDestroy {
if (!result) {
return;
}
const authComp: DialogRef<boolean, any> = TwoFactorDuoComponent.open(this.dialogService, {
const duoComp: DialogRef<boolean, any> = TwoFactorDuoComponent.open(this.dialogService, {
data: result,
});
authComp.componentInstance.onChangeStatus.subscribe((result: any) => {
this.updateStatus(result, TwoFactorProviderType.Duo);
duoComp.componentInstance.onChangeStatus.subscribe((enabled: boolean) => {
this.updateStatus(enabled, TwoFactorProviderType.Duo);
});
// const duoComp = TwoFactorDuoComponent.open(this.dialogService, { data: result });
// const response: boolean = await lastValueFrom(duoComp.closed);
// if (response !== null) {
// this.updateStatus(response, TwoFactorProviderType.Duo);
// }
break;
}
case TwoFactorProviderType.Email: {