- test of spid login;

This commit is contained in:
Vitalii Kiiko
2024-09-26 09:58:08 +02:00
parent 1612442ad2
commit 1bd00def4b
5 changed files with 74 additions and 2 deletions

View File

@@ -9,13 +9,17 @@ import { storeSet, useStore } from '../../store';
// components
import LogoIcon from '../../icons/LogoIcon';
import { Messages } from 'primereact/messages';
import { useParams } from 'react-router-dom';
const API_BASE_URL = process.env.REACT_APP_API_EXECUTION_ADDRESS;
const Login = () => {
const token = useStore().main.token();
const errorMsgs = useRef(null);
let { temp_token } = useParams();
const loginWithSpid = () => {
console.log('spid')
window.location.replace(`${API_BASE_URL}/saml2/authenticate/loginumbria`);
}
useEffect(() => {
@@ -24,6 +28,10 @@ const Login = () => {
}
}, [token]);
useEffect(() => {
console.log('temp_token', temp_token)
}, [temp_token]);
return (
<div className={classNames(['appPage', 'appPageLogin'])}>
<div className="appPageLogin__wrapper">

View File

@@ -0,0 +1,53 @@
import React, { useState, useEffect, useRef } from 'react';
import { __, sprintf } from '@wordpress/i18n';
import { useNavigate, useParams } from 'react-router-dom';
import { is } from 'ramda';
// store
import { storeSet, useStore } from '../../store';
// components
import { Messages } from 'primereact/messages';
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
const Profile = () => {
const isAsyncRequest = useStore().main.isAsyncRequest();
const { id } = useParams();
const [data, setData] = useState({});
const infoMsgs = useRef(null);
const getCallback = (data) => {
if (data.status === 'SUCCESS') {
//setData(getFormattedBandiData(data.data));
}
storeSet.main.unsetAsyncRequest();
}
const errGetCallback = (data) => {
set404FromErrorResponse(data);
storeSet.main.unsetAsyncRequest();
}
useEffect(() => {
//BandoService.getBando(bandoId, getCallback, errGetCallback);
}, [id]);
return (
<div className="appPage">
<div className="appPage__pageHeader">
<h1>{data.name}</h1>
<p>
{__('Profilo utente', 'gepafin')}
</p>
</div>
<div className="appPage__spacer"></div>
<Messages ref={infoMsgs}/>
</div>
)
}
export default Profile;

View File

@@ -3,6 +3,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { useForm } from 'react-hook-form';
import { classNames } from 'primereact/utils';
import { isEmpty } from 'ramda';
import { useParams } from 'react-router-dom';
// api
import AuthenticationService from '../../service/authentication-service';
@@ -23,6 +24,7 @@ const Registration = () => {
const token = useStore().main.token();
const [loading, setLoading] = useState(false);
const errorMsgs = useRef(null);
let { temp_token } = useParams();
const {
control,
handleSubmit,
@@ -73,6 +75,10 @@ const Registration = () => {
}
}, [token]);
useEffect(() => {
console.log('temp_token', temp_token)
}, [temp_token]);
return (
<div className={classNames(['appPage', 'appPageLogin'])}>
<div className="appPageLogin__wrapper">

View File

@@ -20,6 +20,7 @@ import BandoApplication from './pages/BandoApplication';
import Registration from './pages/Registration';
import BandiBeneficiario from './pages/BandiBeneficiario';
import LoginAdmin from './pages/LoginAdmin';
import Profile from './pages/Profile';
const routes = ({ role }) => {
return (
@@ -69,6 +70,10 @@ const routes = ({ role }) => {
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <BandoApplication/> : null}
</DefaultLayout>}/>
<Route path="/profilo" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <Profile/> : null}
</DefaultLayout>}/>
</Route>
<Route exact path="/login" element={<Login/>}/>
<Route exact path="/loginAdmin" element={<LoginAdmin/>}/>