Atomic Angular — Doc interne

Change Password

A current/new/confirm password form that signs the user back in on success, so the session is never left stale — used both as the /login?mode=changepassword route and embedded in a profile panel.

ChangePassword renders the change-password form and, on success, signs the user back in with the new password — the session is never left stale. It is used both as a standalone view (the /login?mode=changepassword route, through AuthPageComponent) and embedded — the user-profile panel hosts it inline.

Minimal example

Standalone
sample.component.ts
import { Component, signal } from "@angular/core";
import { ChangePasswordComponent } from "@sinequa/atomic-angular";

@Component({
  selector: "sample-component",
  imports: [ChangePasswordComponent],
  template: `<change-password [username]="username()" (cancel)="back()" />`,
})
export class SampleComponent {
  readonly username = signal("john");
  back() {
    /* … */
  }
}

How it works

no yes failed ok no yes failed ok yes no submit(passwordForm) valid? mark touched, show messages api.password.change(new, current) errorMsg + audit Change_Password_Failed username resolved? notify + navigate to /login auth.logout(), drop the old token auth.login(username, newPassword) navigate to /login?username=... redirectAfterSuccess? initialize, navigate to / emit success

The old token is cleared after the change succeeds, never before — a failed change leaves the session intact.

Recipes

Embedded in a panel or a dialog

No navigation on success or cancel
profile-panel.component.html
<ChangePassword
  [username]="username()"
  [redirectAfterSuccess]="false"
  [redirectAfterCancel]="false"
  (cancel)="changingPassword.set(false)"
  (success)="changingPassword.set(false)"
/>

Options

Prop

Type

Prop

Type

Pitfalls

What's next

On this page