Skip to content

Commit

Permalink
feat: added change password button to user edit page
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilczaja committed Dec 13, 2024
1 parent 710351a commit 231e869
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface AppConfig {
backendUrl: string;
loginUrl: string;
logoutUrl: string;
updatePasswordUrl: string;
invalidateSessionCookiesUrl: string;
useFakeBackend: boolean;
useLocalBackend: boolean;
Expand All @@ -70,6 +71,7 @@ export interface AppConfigEnv {
AUTHORITY_PORTAL_FRONTEND_BACKEND_URL: string;
AUTHORITY_PORTAL_FRONTEND_LOGIN_URL: string;
AUTHORITY_PORTAL_FRONTEND_LOGOUT_URL: string;
AUTHORITY_PORTAL_FRONTEND_UPDATE_PASSWORD_URL: string;
AUTHORITY_PORTAL_FRONTEND_USE_FAKE_BACKEND: string;
AUTHORITY_PORTAL_FRONTEND_USE_LOCAL_BACKEND: string;
AUTHORITY_PORTAL_FRONTEND_INVALIDATE_SESSION_COOKIES_URL: string;
Expand Down Expand Up @@ -99,6 +101,7 @@ export function buildAppConfig(envVars: AppConfigEnv): AppConfig {
backendUrl: envVars.AUTHORITY_PORTAL_FRONTEND_BACKEND_URL,
loginUrl: envVars.AUTHORITY_PORTAL_FRONTEND_LOGIN_URL,
logoutUrl: envVars.AUTHORITY_PORTAL_FRONTEND_LOGOUT_URL,
updatePasswordUrl: envVars.AUTHORITY_PORTAL_FRONTEND_UPDATE_PASSWORD_URL,
invalidateSessionCookiesUrl:
envVars.AUTHORITY_PORTAL_FRONTEND_INVALIDATE_SESSION_COOKIES_URL,
useFakeBackend:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
* Contributors:
* sovity GmbH - initial implementation
*/
import {Injectable} from '@angular/core';
import {Inject, Injectable} from '@angular/core';
import {FormBuilder} from '@angular/forms';
import {Router} from '@angular/router';
import {Observable} from 'rxjs';
import {ignoreElements, switchMap, take, tap} from 'rxjs/operators';
import {Action, State, StateContext} from '@ngxs/store';
Expand All @@ -20,6 +21,7 @@ import {ApiService} from 'src/app/core/api/api.service';
import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
import {CustomRxjsOperators} from 'src/app/core/services/custom-rxjs-operators';
import {Fetched} from 'src/app/core/utils/fetched';
import {APP_CONFIG, AppConfig} from '../../../core/services/config/app-config';
import {HeaderBarConfig} from '../../../shared/common/header-bar/header-bar.model';
import {ControlCenterUserEditPageForm} from '../control-center-user-edit-page/control-center-user-edit-page.form';
import {
Expand All @@ -45,6 +47,8 @@ export class ControlCenterUserEditPageStateImpl {
private formBuilder: FormBuilder,
private customRxjsOperators: CustomRxjsOperators,
private globalStateUtils: GlobalStateUtils,
private router: Router,
@Inject(APP_CONFIG) private appConfig: AppConfig,
) {}

@Action(Reset)
Expand Down Expand Up @@ -89,7 +93,15 @@ export class ControlCenterUserEditPageStateImpl {
return {
title: `${user.firstName} ${user.lastName}`,
subtitle: 'Edit Your Profile Information',
headerActions: [],
headerActions: [
{
label: 'Change Password',
action: () => {
window.location.href = this.appConfig.updatePasswordUrl;
},
permissions: ['USER'],
},
],
};
}
private rebuildForm(data: UserDetailDto): ControlCenterUserEditPageForm {
Expand Down

0 comments on commit 231e869

Please sign in to comment.