RED-8565: fixed password reset redirect.

This commit is contained in:
Nicoleta Panaghiu 2024-02-21 10:09:44 +02:00
parent 5dcfdff59e
commit ef7faa40e1
3 changed files with 9 additions and 12 deletions

View File

@ -28,7 +28,7 @@
</div>
<div class="iqser-input-group">
<a [href]="changePasswordUrl" target="_blank"> {{ 'user-profile-screen.actions.change-password' | translate }}</a>
<a (click)="resetPassword()" target="_blank"> {{ 'user-profile-screen.actions.change-password' | translate }}</a>
</div>
<div *ngIf="devMode" class="iqser-input-group">

View File

@ -1,11 +1,9 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, inject, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { DomSanitizer } from '@angular/platform-browser';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { BaseFormComponent, getConfig, IqserPermissionsService, LanguageService, LoadingService, Toaster } from '@iqser/common-ui';
import { TenantsService } from '@iqser/common-ui/lib/tenants';
import { BaseFormComponent, IqserPermissionsService, LanguageService, LoadingService, Toaster } from '@iqser/common-ui';
import { TranslateService } from '@ngx-translate/core';
import { AppConfig, IProfile } from '@red/domain';
import { IProfile } from '@red/domain';
import { languagesTranslations } from '@translations/languages-translations';
import { Roles } from '@users/roles';
import { UserPreferenceService } from '@users/user-preference.service';
@ -22,10 +20,8 @@ export class UserProfileScreenComponent extends BaseFormComponent implements OnI
#profileModel: IProfile;
readonly translations = languagesTranslations;
readonly devMode = this._userPreferenceService.isIqserDevMode;
readonly changePasswordUrl: string;
constructor(
domSanitizer: DomSanitizer,
private readonly _userService: UserService,
private readonly _loadingService: LoadingService,
private readonly _dialogService: UserProfileDialogService,
@ -39,9 +35,6 @@ export class UserProfileScreenComponent extends BaseFormComponent implements OnI
) {
super();
this._loadingService.start();
const tenant = inject(TenantsService).activeTenantId;
const realmUrl = `${getConfig<AppConfig>().OAUTH_URL}/realms/${tenant}`;
this.changePasswordUrl = `${realmUrl}/account/password`;
}
get languageChanged(): boolean {
@ -115,6 +108,10 @@ export class UserProfileScreenComponent extends BaseFormComponent implements OnI
}
}
async resetPassword() {
await this._userService.createResetPasswordAction();
}
private _getForm(): UntypedFormGroup {
return this._formBuilder.group({
email: ['', [Validators.required, Validators.email]],

@ -1 +1 @@
Subproject commit 7b29cc5f317838df075a939f2679bd899ef843bf
Subproject commit a2d30f0a652650325eba1c333a2790527d054c08