feat(users): OTP delivery method picker on user creation + post-login agreement
Create User dialog now has a mandatory Email/Mobile OTP delivery method picker (styled as a pill toggle) alongside the existing fields. Adds a new post-login agreement acceptance dialog: right after the existing 2FA flow (TwoFactorAuthenticationComponent) succeeds, or immediately after login for users without 2FA, the user must accept the bank's current agreement/disclaimer at least once before reaching the app. Also adds a "Manage User Agreement" admin screen (System section) to publish versioned agreement text without a code deploy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright since 2025 Mifos Initiative
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** A single published version of the bank's user agreement/warning text. */
|
||||
export interface UserAgreement {
|
||||
id: number;
|
||||
version: number;
|
||||
title: string;
|
||||
body: string;
|
||||
isActive?: boolean;
|
||||
createdByUsername?: string;
|
||||
createdOn?: string | number[];
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class UserAgreementService {
|
||||
private http = inject(HttpClient);
|
||||
|
||||
/** List all published versions, newest first. */
|
||||
getAll(): Observable<UserAgreement[]> {
|
||||
return this.http.get<UserAgreement[]>('/useragreements');
|
||||
}
|
||||
|
||||
/** The currently-active version — the one new users must accept. */
|
||||
getActive(): Observable<UserAgreement> {
|
||||
return this.http.get<UserAgreement>('/useragreements/active');
|
||||
}
|
||||
|
||||
/** Publish a new version. The backend deactivates the previous active row automatically. */
|
||||
create(data: { title: string; body: string }): Observable<{ resourceId: number }> {
|
||||
return this.http.post<{ resourceId: number }>('/useragreements', data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user