diff --git a/src/lib/ae_core/core__user.ts b/src/lib/ae_core/core__user.ts index 01246a27..7c2cae27 100644 --- a/src/lib/ae_core/core__user.ts +++ b/src/lib/ae_core/core__user.ts @@ -279,3 +279,62 @@ export async function qry_ae_obj_li__user_email( } return ae_promises.qry__user_email; } + + +// Change user password +// endpoint: PATCH /user/{user_id}/change_password +// params: +// data_kv: password (the new password) +// Updated 2025-04-11 +export async function auth_ae_obj__user_id_change_password( + { + api_cfg, + account_id, + user_id, + password, + params = {}, + log_lvl = 0 + }: { + api_cfg: any, + account_id: string, + user_id: string, + password: string, + params?: key_val, + log_lvl?: number + } + ) { + if (log_lvl) { + console.log(`*** auth_ae_obj__user_id_change_password() *** account_id=${account_id} user_id=${user_id}`); + } + + let endpoint = `/user/${user_id}/change_password`; + + params['user_id'] = user_id; // Required + if (log_lvl > 1) { + console.log(`auth_ae_obj__user_id_change_password() - params:`, params); + } + + ae_promises.change_password__user_id = await api.patch_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + data: { password: password }, + log_lvl: log_lvl + }) + .then(async function (change_password_result) { + if (change_password_result) { + return change_password_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error) { + console.log('No results returned or failed.', error); + }); + + if (log_lvl) { + console.log('ae_promises.change_password__user_id:', ae_promises.change_password__user_id); + } + return ae_promises.change_password__user_id; +} diff --git a/src/lib/element_sign_in_out.svelte b/src/lib/element_sign_in_out.svelte index ec5e175f..079d7b59 100644 --- a/src/lib/element_sign_in_out.svelte +++ b/src/lib/element_sign_in_out.svelte @@ -568,6 +568,24 @@ function handle_lookup_user_email({email}: {email: string}) { {$ae_loc?.user.username ?? '-- not set --'} + + + {#if $ae_loc.edit_mode} + + {/if} + diff --git a/src/routes/journals/ae_comp__journal_entry_obj_id_view.svelte b/src/routes/journals/ae_comp__journal_entry_obj_id_view.svelte index ca751015..3f5f980e 100644 --- a/src/routes/journals/ae_comp__journal_entry_obj_id_view.svelte +++ b/src/routes/journals/ae_comp__journal_entry_obj_id_view.svelte @@ -204,7 +204,7 @@ async function change_journal_id() { console.error('Error updating journal entry:', error); alert('Failed to update journal entry.'); } - + $journals_slct.journal_id = tmp_entry_obj?.journal_id; goto(`/journals/${tmp_entry_obj?.journal_id}`); } @@ -674,6 +674,7 @@ async function change_journal_id() { class=" flex-grow flex flex-col items-center justify-center + w-full max-w-6xl " >