- test of spid login;
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
REACT_APP_TAB_TITLE=Gepafin
|
REACT_APP_TAB_TITLE=Gepafin
|
||||||
REACT_APP_API_EXECUTION_ADDRESS=http://79.137.88.15/v1
|
REACT_APP_API_EXECUTION_ADDRESS=http://bandi.gepafin.it/v1
|
||||||
REACT_APP_LOGO_FILENAME=logo.svg
|
REACT_APP_LOGO_FILENAME=logo.svg
|
||||||
@@ -9,13 +9,17 @@ import { storeSet, useStore } from '../../store';
|
|||||||
// components
|
// components
|
||||||
import LogoIcon from '../../icons/LogoIcon';
|
import LogoIcon from '../../icons/LogoIcon';
|
||||||
import { Messages } from 'primereact/messages';
|
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 Login = () => {
|
||||||
const token = useStore().main.token();
|
const token = useStore().main.token();
|
||||||
const errorMsgs = useRef(null);
|
const errorMsgs = useRef(null);
|
||||||
|
let { temp_token } = useParams();
|
||||||
|
|
||||||
const loginWithSpid = () => {
|
const loginWithSpid = () => {
|
||||||
console.log('spid')
|
window.location.replace(`${API_BASE_URL}/saml2/authenticate/loginumbria`);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -24,6 +28,10 @@ const Login = () => {
|
|||||||
}
|
}
|
||||||
}, [token]);
|
}, [token]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('temp_token', temp_token)
|
||||||
|
}, [temp_token]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(['appPage', 'appPageLogin'])}>
|
<div className={classNames(['appPage', 'appPageLogin'])}>
|
||||||
<div className="appPageLogin__wrapper">
|
<div className="appPageLogin__wrapper">
|
||||||
|
|||||||
53
src/pages/Profile/index.js
Normal file
53
src/pages/Profile/index.js
Normal 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;
|
||||||
@@ -3,6 +3,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { classNames } from 'primereact/utils';
|
import { classNames } from 'primereact/utils';
|
||||||
import { isEmpty } from 'ramda';
|
import { isEmpty } from 'ramda';
|
||||||
|
import { useParams } from 'react-router-dom';
|
||||||
|
|
||||||
// api
|
// api
|
||||||
import AuthenticationService from '../../service/authentication-service';
|
import AuthenticationService from '../../service/authentication-service';
|
||||||
@@ -23,6 +24,7 @@ const Registration = () => {
|
|||||||
const token = useStore().main.token();
|
const token = useStore().main.token();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const errorMsgs = useRef(null);
|
const errorMsgs = useRef(null);
|
||||||
|
let { temp_token } = useParams();
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
@@ -73,6 +75,10 @@ const Registration = () => {
|
|||||||
}
|
}
|
||||||
}, [token]);
|
}, [token]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('temp_token', temp_token)
|
||||||
|
}, [temp_token]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(['appPage', 'appPageLogin'])}>
|
<div className={classNames(['appPage', 'appPageLogin'])}>
|
||||||
<div className="appPageLogin__wrapper">
|
<div className="appPageLogin__wrapper">
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import BandoApplication from './pages/BandoApplication';
|
|||||||
import Registration from './pages/Registration';
|
import Registration from './pages/Registration';
|
||||||
import BandiBeneficiario from './pages/BandiBeneficiario';
|
import BandiBeneficiario from './pages/BandiBeneficiario';
|
||||||
import LoginAdmin from './pages/LoginAdmin';
|
import LoginAdmin from './pages/LoginAdmin';
|
||||||
|
import Profile from './pages/Profile';
|
||||||
|
|
||||||
const routes = ({ role }) => {
|
const routes = ({ role }) => {
|
||||||
return (
|
return (
|
||||||
@@ -69,6 +70,10 @@ const routes = ({ role }) => {
|
|||||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_BENEFICIARY' === role ? <BandoApplication/> : null}
|
{'ROLE_BENEFICIARY' === role ? <BandoApplication/> : null}
|
||||||
</DefaultLayout>}/>
|
</DefaultLayout>}/>
|
||||||
|
<Route path="/profilo" element={<DefaultLayout>
|
||||||
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_BENEFICIARY' === role ? <Profile/> : null}
|
||||||
|
</DefaultLayout>}/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route exact path="/login" element={<Login/>}/>
|
<Route exact path="/login" element={<Login/>}/>
|
||||||
<Route exact path="/loginAdmin" element={<LoginAdmin/>}/>
|
<Route exact path="/loginAdmin" element={<LoginAdmin/>}/>
|
||||||
|
|||||||
Reference in New Issue
Block a user