fix(esx_identity): DOB validation

This commit is contained in:
Ilias Rbayti
2024-11-13 22:26:55 +01:00
parent 45d66b805a
commit 4c74d55cf0
4 changed files with 13 additions and 11 deletions
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -11,11 +11,11 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
crossorigin="anonymous" referrerpolicy="no-referrer" /> crossorigin="anonymous" referrerpolicy="no-referrer" />
<script type="module" crossorigin src="./assets/index-CQllZdg3.js"></script> <script type="module" crossorigin src="./assets/index-DJTiCb6I.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-CBKwBtku.css"> <link rel="stylesheet" crossorigin href="./assets/index-CBKwBtku.css">
</head> </head>
<body class="nonde"> <body class="none">
<div id="app"></div> <div id="app"></div>
</body> </body>
+3 -1
View File
@@ -243,6 +243,8 @@ end
ESX.RegisterServerCallback("esx_identity:registerIdentity", function(source, cb, data) ESX.RegisterServerCallback("esx_identity:registerIdentity", function(source, cb, data)
local xPlayer = ESX.GetPlayerFromId(source) local xPlayer = ESX.GetPlayerFromId(source)
data.dateofbirth = formatDate(data.dateofbirth)
if not checkNameFormat(data.firstname) then if not checkNameFormat(data.firstname) then
TriggerClientEvent("esx:showNotification", source, TranslateCap("invalid_firstname_format"), "error") TriggerClientEvent("esx:showNotification", source, TranslateCap("invalid_firstname_format"), "error")
return cb(false) return cb(false)
@@ -272,7 +274,7 @@ end
playerIdentity[xPlayer.identifier] = { playerIdentity[xPlayer.identifier] = {
firstName = formatName(data.firstname), firstName = formatName(data.firstname),
lastName = formatName(data.lastname), lastName = formatName(data.lastname),
dateOfBirth = formatDate(data.dateofbirth), dateOfBirth = data.dateofbirth,
sex = data.sex, sex = data.sex,
height = data.height, height = data.height,
} }
@@ -10,7 +10,7 @@ const onSubmit = (values) => {
body: JSON.stringify({ body: JSON.stringify({
firstname: values.firstname, firstname: values.firstname,
lastname: values.lastname, lastname: values.lastname,
dateofbirth: values.dob, dateofbirth: moment(values.dob).format("DD/MM/YYYY"),
sex: values.gender, sex: values.gender,
height: values.height, height: values.height,
}), }),