This commit is contained in:
Bright 2025-06-06 16:55:38 +07:00
parent d3e31eaf14
commit 7c4f6249b8
2 changed files with 50 additions and 30 deletions

View file

@ -3534,13 +3534,17 @@ export class CommandController extends Controller {
if (checkUser.length == 0) {
let password = profile.citizenId;
if (profile.birthDate != null) {
const gregorianYear = profile.birthDate.getFullYear() + 543;
// const gregorianYear = profile.birthDate.getFullYear() + 543;
const formattedDate =
profile.birthDate.toISOString().slice(8, 10) +
profile.birthDate.toISOString().slice(5, 7) +
gregorianYear;
password = formattedDate;
// const formattedDate =
// profile.birthDate.toISOString().slice(8, 10) +
// profile.birthDate.toISOString().slice(5, 7) +
// gregorianYear;
// password = formattedDate;
const _date = new Date(profile.birthDate.toDateString()).getDate().toString().padStart(2, "0");
const _month = (new Date(profile.birthDate.toDateString()).getMonth()+1).toString().padStart(2, "0");
const _year = (new Date(profile.birthDate.toDateString()).getFullYear()+543);
password = `${_date}${_month}${_year}`
}
userKeycloakId = await createUser(profile.citizenId, password, {
firstName: profile.firstName,
@ -5411,13 +5415,17 @@ export class CommandController extends Controller {
if (checkUser.length == 0) {
let password = item.bodyProfile.citizenId;
if (item.bodyProfile.birthDate != null) {
const gregorianYear = item.bodyProfile.birthDate.getFullYear() + 543;
// const gregorianYear = item.bodyProfile.birthDate.getFullYear() + 543;
const formattedDate =
item.bodyProfile.birthDate.toISOString().slice(8, 10) +
item.bodyProfile.birthDate.toISOString().slice(5, 7) +
gregorianYear;
password = formattedDate;
// const formattedDate =
// item.bodyProfile.birthDate.toISOString().slice(8, 10) +
// item.bodyProfile.birthDate.toISOString().slice(5, 7) +
// gregorianYear;
// password = formattedDate;
const _date = new Date(item.bodyProfile.birthDate.toDateString()).getDate().toString().padStart(2, "0");
const _month = (new Date(item.bodyProfile.birthDate.toDateString()).getMonth()+1).toString().padStart(2, "0");
const _year = (new Date(item.bodyProfile.birthDate.toDateString()).getFullYear()+543);
password = `${_date}${_month}${_year}`
}
userKeycloakId = await createUser(item.bodyProfile.citizenId, password, {
firstName: item.bodyProfile.firstName,
@ -6102,13 +6110,17 @@ export class CommandController extends Controller {
if (checkUser.length == 0) {
let password = profile.citizenId;
if (profile.birthDate != null) {
const gregorianYear = profile.birthDate.getFullYear() + 543;
// const gregorianYear = profile.birthDate.getFullYear() + 543;
const formattedDate =
profile.birthDate.toISOString().slice(8, 10) +
profile.birthDate.toISOString().slice(5, 7) +
gregorianYear;
password = formattedDate;
// const formattedDate =
// profile.birthDate.toISOString().slice(8, 10) +
// profile.birthDate.toISOString().slice(5, 7) +
// gregorianYear;
// password = formattedDate;
const _date = new Date(profile.birthDate.toDateString()).getDate().toString().padStart(2, "0");
const _month = (new Date(profile.birthDate.toDateString()).getMonth()+1).toString().padStart(2, "0");
const _year = (new Date(profile.birthDate.toDateString()).getFullYear()+543);
password = `${_date}${_month}${_year}`
}
const userKeycloakId = await createUser(profile.citizenId, password, {
firstName: profile.firstName,

View file

@ -845,13 +845,17 @@ export class KeycloakController extends Controller {
for await (const _item of profiles) {
let password = _item.citizenId;
if (_item.birthDate != null) {
const gregorianYear = _item.birthDate.getFullYear() + 543;
// const gregorianYear = _item.birthDate.getFullYear() + 543;
const formattedDate =
_item.birthDate.toISOString().slice(8, 10) +
_item.birthDate.toISOString().slice(5, 7) +
gregorianYear;
password = formattedDate;
// const formattedDate =
// _item.birthDate.toISOString().slice(8, 10) +
// _item.birthDate.toISOString().slice(5, 7) +
// gregorianYear;
// password = formattedDate;
const _date = new Date(_item.birthDate.toDateString()).getDate().toString().padStart(2, "0");
const _month = (new Date(_item.birthDate.toDateString()).getMonth()+1).toString().padStart(2, "0");
const _year = (new Date(_item.birthDate.toDateString()).getFullYear()+543);
password = `${_date}${_month}${_year}`
}
const checkUser = await getUserByUsername(_item.citizenId);
let userId: any = "";
@ -907,13 +911,17 @@ export class KeycloakController extends Controller {
for await (const _item of profiles) {
let password = _item.citizenId;
if (_item.birthDate != null) {
const gregorianYear = _item.birthDate.getFullYear() + 543;
// const gregorianYear = _item.birthDate.getFullYear() + 543;
const formattedDate =
_item.birthDate.toISOString().slice(8, 10) +
_item.birthDate.toISOString().slice(5, 7) +
gregorianYear;
password = formattedDate;
// const formattedDate =
// _item.birthDate.toISOString().slice(8, 10) +
// _item.birthDate.toISOString().slice(5, 7) +
// gregorianYear;
// password = formattedDate;
const _date = new Date(_item.birthDate.toDateString()).getDate().toString().padStart(2, "0");
const _month = (new Date(_item.birthDate.toDateString()).getMonth()+1).toString().padStart(2, "0");
const _year = (new Date(_item.birthDate.toDateString()).getFullYear()+543);
password = `${_date}${_month}${_year}`
}
const checkUser = await getUserByUsername(_item.citizenId);
let userId: any = "";