nomenclature
nomenclature
This commit is contained in:
@@ -127,7 +127,7 @@
|
|||||||
|
|
||||||
let isUpdating = false,
|
let isUpdating = false,
|
||||||
password = '',
|
password = '',
|
||||||
password2 = '';
|
confirm_password = '';
|
||||||
|
|
||||||
/** @type {Object.<string, App.Locals['licence_categories']>} */
|
/** @type {Object.<string, App.Locals['licence_categories']>} */
|
||||||
$: groupedCategories = groupCategories(licence_categories);
|
$: groupedCategories = groupCategories(licence_categories);
|
||||||
@@ -249,14 +249,14 @@
|
|||||||
label={$t('password')}
|
label={$t('password')}
|
||||||
placeholder={$t('placeholder.password')}
|
placeholder={$t('placeholder.password')}
|
||||||
bind:value={password}
|
bind:value={password}
|
||||||
otherPasswordValue={password2}
|
otherPasswordValue={confirm_password}
|
||||||
/>
|
/>
|
||||||
<InputField
|
<InputField
|
||||||
name="password2"
|
name="confirm_password"
|
||||||
type="password"
|
type="password"
|
||||||
label={$t('password_repeat')}
|
label={$t('confirm_password')}
|
||||||
placeholder={$t('placeholder.password')}
|
placeholder={$t('placeholder.password')}
|
||||||
bind:value={password2}
|
bind:value={confirm_password}
|
||||||
otherPasswordValue={password}
|
otherPasswordValue={password}
|
||||||
/>
|
/>
|
||||||
<InputField
|
<InputField
|
||||||
@@ -269,7 +269,7 @@
|
|||||||
/>
|
/>
|
||||||
<InputField
|
<InputField
|
||||||
name="user[last_name]"
|
name="user[last_name]"
|
||||||
label={$t('last_name')}
|
label={$t('user.last_name')}
|
||||||
bind:value={localUser.last_name}
|
bind:value={localUser.last_name}
|
||||||
placeholder={$t('placeholder.last_name')}
|
placeholder={$t('placeholder.last_name')}
|
||||||
required={true}
|
required={true}
|
||||||
@@ -292,14 +292,14 @@
|
|||||||
<InputField
|
<InputField
|
||||||
name="user[phone]"
|
name="user[phone]"
|
||||||
type="tel"
|
type="tel"
|
||||||
label={$t('phone')}
|
label={$t('user.phone')}
|
||||||
bind:value={localUser.phone}
|
bind:value={localUser.phone}
|
||||||
placeholder={$t('placeholder.phone')}
|
placeholder={$t('placeholder.phone')}
|
||||||
/>
|
/>
|
||||||
<InputField
|
<InputField
|
||||||
name="user[dateofbirth]"
|
name="user[dateofbirth]"
|
||||||
type="date"
|
type="date"
|
||||||
label={$t('dateofbirth')}
|
label={$t('user.dateofbirth')}
|
||||||
bind:value={localUser.dateofbirth}
|
bind:value={localUser.dateofbirth}
|
||||||
placeholder={$t('placeholder.dateofbirth')}
|
placeholder={$t('placeholder.dateofbirth')}
|
||||||
readonly={role_id === 0}
|
readonly={role_id === 0}
|
||||||
|
|||||||
@@ -3,18 +3,18 @@ import { toRFC3339 } from './helpers';
|
|||||||
/**
|
/**
|
||||||
* Converts FormData to a nested object structure
|
* Converts FormData to a nested object structure
|
||||||
* @param {FormData} formData - The FormData object to convert
|
* @param {FormData} formData - The FormData object to convert
|
||||||
* @returns {{ object: Partial<App.Locals['user']> | Partial<App.Types['subscription']>, password2: string }} Nested object representation of the form data
|
* @returns {{ object: Partial<App.Locals['user']> | Partial<App.Types['subscription']>, confirm_password: string }} Nested object representation of the form data
|
||||||
*/
|
*/
|
||||||
export function formDataToObject(formData) {
|
export function formDataToObject(formData) {
|
||||||
/** @type { Partial<App.Locals['user']> | Partial<App.Types['subscription']> } */
|
/** @type { Partial<App.Locals['user']> | Partial<App.Types['subscription']> } */
|
||||||
const object = {};
|
const object = {};
|
||||||
let password2 = '';
|
let confirm_password = '';
|
||||||
|
|
||||||
console.log('Form data entries:');
|
console.log('Form data entries:');
|
||||||
for (const [key, value] of formData.entries()) {
|
for (const [key, value] of formData.entries()) {
|
||||||
console.log('Key:', key, 'Value:', value);
|
console.log('Key:', key, 'Value:', value);
|
||||||
if (key == 'password2') {
|
if (key == 'confirm_password') {
|
||||||
password2 = String(value);
|
confirm_password = String(value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/** @type {string[]} */
|
/** @type {string[]} */
|
||||||
@@ -56,12 +56,12 @@ export function formDataToObject(formData) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { object: object, password2: password2 };
|
return { object: object, confirm_password: confirm_password };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes the raw form data into the expected user data structure
|
* Processes the raw form data into the expected user data structure
|
||||||
* @param {{ object: Partial<App.Locals['user']>, password2: string} } rawData - The raw form data object
|
* @param {{ object: Partial<App.Locals['user']>, confirm_password: string} } rawData - The raw form data object
|
||||||
* @returns {{ user: Partial<App.Locals['user']> }} Processed user data
|
* @returns {{ user: Partial<App.Locals['user']> }} Processed user data
|
||||||
*/
|
*/
|
||||||
export function processUserFormData(rawData) {
|
export function processUserFormData(rawData) {
|
||||||
@@ -130,8 +130,8 @@ export function processUserFormData(rawData) {
|
|||||||
console.dir(rawData.object.licence);
|
console.dir(rawData.object.licence);
|
||||||
if (
|
if (
|
||||||
rawData.object.password &&
|
rawData.object.password &&
|
||||||
rawData.password2 &&
|
rawData.confirm_password &&
|
||||||
rawData.object.password === rawData.password2 &&
|
rawData.object.password === rawData.confirm_password &&
|
||||||
rawData.object.password.trim() !== ''
|
rawData.object.password.trim() !== ''
|
||||||
) {
|
) {
|
||||||
processedData.user.password = rawData.object.password;
|
processedData.user.password = rawData.object.password;
|
||||||
|
|||||||
Reference in New Issue
Block a user