mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
minor changes
This commit is contained in:
parent
4b1b5a3dbe
commit
025f6b3df2
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -57,3 +57,4 @@ bower_components
|
|||
|
||||
# Environments
|
||||
venv/
|
||||
/GitExtensions.settings
|
||||
|
|
|
@ -77,7 +77,7 @@ export const UserProfileState = ({ children }: UserProfileStateProps) => {
|
|||
onError: error => { setError(error); },
|
||||
onSuccess: () => {
|
||||
setUser(undefined);
|
||||
auth.logout();
|
||||
auth.reload();
|
||||
if (callback) callback();
|
||||
}});
|
||||
}, [setUser, auth]
|
||||
|
|
|
@ -2,7 +2,6 @@ import { useLayoutEffect } from 'react';
|
|||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { TIMEOUT_UI_REFRESH } from '../utils/constants';
|
||||
|
||||
function HomePage() {
|
||||
const navigate = useNavigate();
|
||||
|
@ -10,13 +9,9 @@ function HomePage() {
|
|||
|
||||
useLayoutEffect(() => {
|
||||
if (!user) {
|
||||
setTimeout(() => {
|
||||
navigate('/library?filter=common');
|
||||
}, TIMEOUT_UI_REFRESH);
|
||||
navigate('/library?filter=common');
|
||||
} else if(!user.is_staff) {
|
||||
setTimeout(() => {
|
||||
navigate('/library?filter=personal');
|
||||
}, TIMEOUT_UI_REFRESH);
|
||||
navigate('/library?filter=personal');
|
||||
}
|
||||
}, [navigate, user])
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ export function ChangePassword() {
|
|||
const [old_password, setOldPassword] = useState('');
|
||||
const [new_password, setNewPassword] = useState('');
|
||||
const [new_password_repeat, setNewPasswordRepeat] = useState('');
|
||||
const [password_equal, setPasswordEqual] = useState(true);
|
||||
const [new_pass_color, setNewPassColor] = useState('');
|
||||
const navigate = useNavigate();
|
||||
|
||||
function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault();
|
||||
if (new_password !== new_password_repeat) {
|
||||
setPasswordEqual(false);
|
||||
setNewPassColor('bg-red-500');
|
||||
toast.error('Пароли не совпадают');
|
||||
}
|
||||
else {
|
||||
|
@ -41,21 +41,21 @@ export function ChangePassword() {
|
|||
onChange={event => setOldPassword(event.target.value)}
|
||||
/>
|
||||
<TextInput id='new_password'
|
||||
colorClass={`${password_equal ? "" : "text-red-500"}`}
|
||||
colorClass={new_pass_color}
|
||||
label="Введите новый пароль:"
|
||||
value={new_password}
|
||||
onChange={event => {
|
||||
setNewPassword(event.target.value);
|
||||
setPasswordEqual(true);
|
||||
setNewPassColor('');
|
||||
}}
|
||||
/>
|
||||
<TextInput id='new_password'
|
||||
colorClass={`${password_equal ? "" : "text-red-500"}`}
|
||||
<TextInput id='new_password_repeat'
|
||||
colorClass={new_pass_color}
|
||||
label="Повторите новый пароль:"
|
||||
value={new_password_repeat}
|
||||
onChange={event => {
|
||||
setNewPasswordRepeat(event.target.value);
|
||||
setPasswordEqual(true);
|
||||
setNewPassColor('');
|
||||
}}
|
||||
/>
|
||||
<div className='relative flex justify-center my-4 border'>
|
||||
|
|
Loading…
Reference in New Issue
Block a user