fix tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-14 01:20:27 +03:00
parent 2ce092aa59
commit 2953a97a46
6 changed files with 90 additions and 22 deletions

View File

@ -1,6 +1,7 @@
import { type ReactNode, useEffect, useRef, useState } from 'react';
import { Box, CircularProgress, Typography } from '@mui/material';
import keycloak from '../../services/keycloak';
import { LoginPage } from '../LoginPage';
interface AuthProviderProps {
children: ReactNode;
@ -23,7 +24,7 @@ export function AuthProvider({ children }: AuthProviderProps) {
const initKeycloak = async () => {
try {
const authenticated = await keycloak.init({
onLoad: 'login-required',
onLoad: 'check-sso',
checkLoginIframe: false,
pkceMethod: 'S256',
});
@ -75,18 +76,7 @@ export function AuthProvider({ children }: AuthProviderProps) {
}
if (!isAuthenticated) {
return (
<Box
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '100vh',
}}
>
<Typography>Ошибка авторизации. Перенаправление...</Typography>
</Box>
);
return <LoginPage />;
}
return <>{children}</>;

View File

@ -0,0 +1,54 @@
import { Box, Button, Typography, Paper } from '@mui/material';
import { Login } from '@mui/icons-material';
import keycloak from '../../services/keycloak';
export function LoginPage() {
const handleLogin = () => {
void keycloak.login();
};
return (
<Box
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
minHeight: '100vh',
bgcolor: 'background.default',
}}
>
<Paper
elevation={3}
sx={{
p: 6,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
maxWidth: 400,
textAlign: 'center',
}}
>
<Typography variant="h4" component="h1" gutterBottom fontWeight="bold">
Team Planner
</Typography>
<Typography variant="body1" color="text.secondary" sx={{ mb: 4 }}>
Приложение для управления бэклогом идей команды
</Typography>
<Button
variant="contained"
size="large"
startIcon={<Login />}
onClick={handleLogin}
sx={{ mb: 4, px: 4, py: 1.5 }}
>
Войти
</Button>
<Typography variant="body2" color="text.secondary">
Для получения доступа обратитесь к Николаю Вигдорову
</Typography>
</Paper>
</Box>
);
}

View File

@ -0,0 +1 @@
export { LoginPage } from './LoginPage';