Update password change flow and date validator logic

Changed the change password API endpoint to use FIRST_LOGIN_URI instead of CHANGE_PASSWORD_URI. Added FIRST_LOGIN_URI to URI enums and app.uri.json. Improved the toDateAfterFromDateValidator to normalize dates, enforce fromDate < toDate, and disallow future dates.
dev-pending-20-01-2026-v1
Naeem Ullah 2 weeks ago
parent 772653b51c
commit efbf56adbc

@ -118,5 +118,6 @@ export class LoggingComponent implements OnInit {
exportDataInExcel(){
this.excelExportServic.exportExcel(this.logsList, LOGGING_DETAILS_FILE_NAME)
}
}

@ -182,7 +182,7 @@ constructor(
const payload = this.getFormPayload();
this.httpURIService.requestPOST(URIKey.CHANGE_PASSWORD_URI, payload)
this.httpURIService.requestPOST(URIKey.FIRST_LOGIN_URI, payload)
.subscribe({
next: (response) => {
if (!(response instanceof HttpErrorResponse)) {

@ -11,24 +11,35 @@ export const pageSizeOptions = [
];
export const toDateAfterFromDateValidator: ValidatorFn = (
group: AbstractControl
control: AbstractControl
): ValidationErrors | null => {
const fromDate = group.get('fromDate')?.value;
const toDate = group.get('toDate')?.value;
const currentDate = new Date().toISOString();
const from = control.get('fromDate')?.value;
const to = control.get('toDate')?.value;
if (!fromDate || !toDate) {
return null;
if (!from || !to) return null;
// Normalize to midnight to avoid timezone bugs
const fromDate = new Date(from);
const toDate = new Date(to);
fromDate.setHours(0, 0, 0, 0);
toDate.setHours(0, 0, 0, 0);
const today = new Date();
today.setHours(0, 0, 0, 0);
// Rule 1: fromDate must be < toDate
if (fromDate >= toDate) {
return { fromDateGreaterThanOrEqualToToDate: true };
}
if(toDate < fromDate)
return { toDateInvalid: true }
else if(toDate >= currentDate)
return { toDateGreaterThanToday: true }
else
return null
// Rule 2: no future dates
if (fromDate > today || toDate > today) {
return { futureDateNotAllowed: true };
}
return null;
};
export const EXCEL_FILE_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';

@ -11,6 +11,7 @@ export enum URIKey {
GET_ALL_USER_URI = "GET_ALL_USER_URI",
RESET_PASSWORD_URI = "RESET_PASSWORD_URI",
CHANGE_PASSWORD_URI = "CHANGE_PASSWORD_URI",
FIRST_LOGIN_URI = "FIRST_LOGIN_URI",
THIRD_PARTY_REGISTER_URI = "THIRD_PARTY_REGISTER_URI",
TRANSACTION_LOGS = "TRANSACTION_LOGS",
LOGGER_MANAGER_URI = "LOGGER_MANAGER_URI"

@ -57,6 +57,11 @@
"URI": "/authentication/change-password",
"UUID": "CHANGE_PASSWORD_URI"
},
{
"Id" : "ENTITY_FIRST_LOGIN_URI",
"URI": "/authentication/first-login",
"UUID": "FIRST_LOGIN_URI"
},
{
"Id" : "ENTITY_USER_SAVE_PERMISSION",
"URI": "/user/updatePermissions",

Loading…
Cancel
Save