diff --git a/src/pages/MainPage/Main.sass b/src/pages/MainPage/Main.sass index 227c4e9..14ce5d9 100644 --- a/src/pages/MainPage/Main.sass +++ b/src/pages/MainPage/Main.sass @@ -95,7 +95,7 @@ h1 &__button padding: 1rem 0 0 0 -.required +.required-config padding: 0.75rem 1rem border-radius: 8px background-color: color.adjust(#0D64E4, $blackness: 20%) diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index dcd0316..3a88be0 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -7,7 +7,7 @@ import { FiLogOut } from 'solid-icons/fi' import { VsRefresh } from 'solid-icons/vs' import { createSignal, onMount, createEffect } from 'solid-js' import { Box, Button, Clickable, Column, Link, Logo, Modal, ModalButton, Padding, Page, Row, Input } from '../../components/' -import { checkConnection, getApi, getApiMulti, postApi, securePassword } from '../../utils/functions' +import { checkConnection, getApi, getApiMulti, postApi, saveNewName, saveNewPassword, securePassword } from '../../utils/functions' import { FaSolidUserGear } from 'solid-icons/fa' import { Show } from 'solid-js/web' import './Main.sass' @@ -322,7 +322,7 @@ export default () => { } const checkCurrentPassword = async () => { - const encCurrentPassword = await securePassword(configPassword()) + const encCurrentPassword = await securePassword(configPassword(), 'v2') if (encCurrentPassword === configEncPassword()) { if (configNewPassword() === '') { setConfigError('New Password not provided') @@ -339,39 +339,39 @@ export default () => { } const encryptNewPassword = async () => { - const encNewPassword = await securePassword(configNewPassword()) + const encNewPassword = await securePassword(configNewPassword(), 'v2') setConfigNewEncPassword(encNewPassword) } const saveConfig = async () => { - if (configNewName() !== '') await saveNewName(configNewName()) - if (configNewPassword() !== '') await saveNewPassword(configNewEncPassword()) + if (configNewName() !== '') await saveNewName(parseInt(ID), configNewName()) + if (configNewPassword() !== '') await saveNewPassword(parseInt(ID), configNewEncPassword()) setConfigNotification(true) } - const saveNewName = async (name: string) => { - await postApi('update-name', { - data: parseInt(ID), - data2: name - }) - } + // const saveNewName = async (name: string) => { + // await postApi('update-name', { + // data: parseInt(ID), + // data2: name + // }) + // } - const saveNewPassword = async (password: string) => { - await postApi('update-password', { - data: parseInt(ID), - data2: password - }) - } + // const saveNewPassword = async (password: string) => { + // await postApi('update-password', { + // data: parseInt(ID), + // data2: password + // }) + // } const logout = async () => { removeEmployee() navigate('/') } - const gotoProfile = () => { - navigate('/profile') - } + // const gotoProfile = () => { + // navigate('/profile') + // } onMount(async () => { const logged = await checkLogged() @@ -407,7 +407,7 @@ export default () => { - {employeeName()} + {employeeName()} setOpenConfig(true)}> @@ -770,7 +770,7 @@ export default () => { - {configError()} + {configError()}