RED-3800: fix change password url

This commit is contained in:
Dan Percic 2023-05-16 23:08:01 +03:00
parent f0506063e7
commit 3c7c37db59
3 changed files with 17 additions and 12 deletions

View File

@ -16,7 +16,7 @@
<input formControlName="lastName" name="lastName" type="text" />
</div>
<div *ngIf="userPreferences.areDevFeaturesEnabled" class="iqser-input-group">
<div *ngIf="devMode" class="iqser-input-group">
<label [translate]="'top-bar.navigation-items.my-account.children.language.label'"></label>
<mat-form-field>
<mat-select formControlName="language">

View File

@ -1,12 +1,19 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, inject, OnInit } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { DomSanitizer } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { BaseFormComponent, IqserPermissionsService, LanguageService, LoadingService, Toaster } from '@iqser/common-ui';
import { IProfile } from '@red/domain';
import {
BaseFormComponent,
getConfig,
IqserPermissionsService,
LanguageService,
LoadingService,
TenantsService,
Toaster,
} from '@iqser/common-ui';
import { AppConfig, IProfile } from '@red/domain';
import { languagesTranslations } from '@translations/languages-translations';
import { UserService } from '@users/user.service';
import { ConfigService } from '@services/config.service';
import { firstValueFrom } from 'rxjs';
import { UserPreferenceService } from '@users/user-preference.service';
import { ROLES } from '@users/roles';
@ -14,7 +21,6 @@ import { UserProfileDialogService } from '../services/user-profile-dialog.servic
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
@Component({
selector: 'redaction-user-profile-screen',
templateUrl: './user-profile-screen.component.html',
styleUrls: ['./user-profile-screen.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@ -22,15 +28,13 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
export class UserProfileScreenComponent extends BaseFormComponent implements OnInit {
readonly translations = languagesTranslations;
readonly devMode = this._userPreferenceService.areDevFeaturesEnabled;
readonly changePasswordUrl: SafeResourceUrl;
readonly changePasswordUrl: string;
#profileModel: IProfile;
constructor(
domSanitizer: DomSanitizer,
configService: ConfigService,
private readonly _userService: UserService,
readonly userPreferences: UserPreferenceService,
private readonly _loadingService: LoadingService,
private readonly _dialogService: UserProfileDialogService,
private readonly _formBuilder: UntypedFormBuilder,
@ -43,7 +47,9 @@ export class UserProfileScreenComponent extends BaseFormComponent implements OnI
) {
super();
this._loadingService.start();
this.changePasswordUrl = domSanitizer.bypassSecurityTrustResourceUrl(`${configService.values.OAUTH_URL}/account/password`);
const tenant = inject(TenantsService).currentTenant;
const realmUrl = `${getConfig<AppConfig>().OAUTH_URL}/realms/${tenant}`;
this.changePasswordUrl = `${realmUrl}/account/password`;
}
get languageChanged(): boolean {

View File

@ -8,7 +8,6 @@
"build-lint-all": "ng build --project=red-ui --configuration production --base-href /ui/",
"build-paligo-styles": "mkdir -p dist/paligo-styles && sass --load-path=. paligo-styles/style.scss > dist/paligo-styles/redacto-theme.css",
"i18n:extract": "ngx-translate-extract --input ./apps/red-ui/src ./libs/common-ui/src --output apps/red-ui/src/assets/i18n/{redact,scm}/{en,de}.json --clean --sort --format namespaced-json && prettier apps/red-ui/src/assets/i18n/*/*.json --write",
"postinstall": "ngcc --properties es2020 browser module main",
"nx": "nx",
"start": "nx serve",
"update": "nx migrate latest",