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