diff --git a/src/Components/SignUpContainerFunction.js b/src/Components/SignUpContainerFunction.js index 89752091cd4787555592c3c307e0ea0424395073..15974aee411a66d7431d73f4ce7d6ba8b87d56a0 100644 --- a/src/Components/SignUpContainerFunction.js +++ b/src/Components/SignUpContainerFunction.js @@ -220,8 +220,8 @@ export default function SignUpContainer (props) { <div style={{margin:"0 auto", width: "304px"}}> { //<ReCaptcha sitekey={process.env.REACT_APP_SITE_KEY} verifyCallback={captchaVerified} /> //when key set in env - //<ReCaptcha sitekey="6LfxuKUUAAAAAIzYpCzEtJyeE8QRjBYa44dvHlTX" verifyCallback={captchaVerified} /> //use this one on production - <ReCaptcha sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI" verifyCallback={captchaVerified}/> //test key, from google, do not use this one on production + <ReCaptcha sitekey="6LfxuKUUAAAAAIzYpCzEtJyeE8QRjBYa44dvHlTX" verifyCallback={captchaVerified} /> //use this one on production + //<ReCaptcha sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI" verifyCallback={captchaVerified}/> //test key, from google, do not use this one on production } </div> <ConfirmContainerStyled> diff --git a/src/Components/SignUpModal.js b/src/Components/SignUpModal.js index e01678072f356a5f7aa4a76da8edfd3052e01167..61c4fb2865b34df44615e742507d94df28e43ad7 100644 --- a/src/Components/SignUpModal.js +++ b/src/Components/SignUpModal.js @@ -15,7 +15,7 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, {useContext} from 'react'; +import React, {useContext, useState} from 'react'; import Modal from '@material-ui/core/Modal'; import Backdrop from '@material-ui/core/Backdrop'; import Fade from '@material-ui/core/Fade'; @@ -23,11 +23,27 @@ import styled from 'styled-components' import SignUpContainer from './SignUpContainerFunction.js' import {Store} from '../Store.js' import {authentication} from './HelperFunctions/getAxiosConfig' +import Snackbar from '@material-ui/core/Snackbar'; +import MuiAlert from '@material-ui/lab/Alert'; //import {postRequest} from './HelperFunctions/getAxiosConfig' +export function Alert(props) { + return <MuiAlert elevation={6} variant="filled" {...props} />; +} + export default function SignUpModal (props) { const { state, dispatch } = useContext(Store) + const [snackbarOpened, handleSnackbar] = useState(false) + + const handleCloseSnackbar = (event, reason) => { + if (reason === 'clickaway') { + return; + } + + handleSnackbar(false); + } + function handleSuccess (data) { dispatch ({ type: 'USER_SIGNED_UP', @@ -36,6 +52,11 @@ export default function SignUpModal (props) { }) props.handleClose() } + + function handleError (error) { + handleSnackbar(true) + } + const handleLoginInfo = (newLogin) => { const url = `/auth` const payload = { @@ -46,32 +67,39 @@ export default function SignUpModal (props) { // terms_of_service : true, // avatar: "" } - authentication(url, payload, handleSuccess, (error) => {console.log(error)}) + authentication(url, payload, handleSuccess, handleError) //postRequest(url, payload, handleSuccess, (error) => {console.log(error)}) } return ( - <StyledModalSignUp - aria-labelledby="transition-modal-title" - aria-describedby="transition-modal-description" - open={props.open} - - centered="true" - onClose={props.handleClose} - closeAfterTransition - BackdropComponent={Backdrop} - BackdropProps={{ - timeout: 500, - }} - > - <Fade in={props.open}> - <SignUpContainer - handleClose={props.handleClose} - openLogin={props.openLogin} - handleLoginInfo = {handleLoginInfo} - /> - </Fade> - </StyledModalSignUp> + <> + <Snackbar open={snackbarOpened} autoHideDuration={1000} onClose={handleCloseSnackbar} + anchorOrigin = {{ vertical:'top', horizontal:'right' }} + > + <Alert severity="error">Ocorreu um erro ao se conectar!</Alert> + </Snackbar> + <StyledModalSignUp + aria-labelledby="transition-modal-title" + aria-describedby="transition-modal-description" + open={props.open} + + centered="true" + onClose={props.handleClose} + closeAfterTransition + BackdropComponent={Backdrop} + BackdropProps={{ + timeout: 500, + }} + > + <Fade in={props.open}> + <SignUpContainer + handleClose={props.handleClose} + openLogin={props.openLogin} + handleLoginInfo = {handleLoginInfo} + /> + </Fade> + </StyledModalSignUp> + </> ) } diff --git a/src/Components/UploadPageComponents/PartThree.js b/src/Components/UploadPageComponents/PartThree.js index e751a1805175b71d28da3251327e097dc6bba7c6..5170659ca6f2e961a14e314a827656737def4000 100644 --- a/src/Components/UploadPageComponents/PartThree.js +++ b/src/Components/UploadPageComponents/PartThree.js @@ -217,8 +217,8 @@ export default function PartThree(props) { <div style={{margin:"0 auto", width: "304px"}}> { //<ReCaptcha sitekey={process.env.REACT_APP_SITE_KEY} verifyCallback={captchaVerified} /> //when key set in env - //<ReCaptcha sitekey="6LfxuKUUAAAAAIzYpCzEtJyeE8QRjBYa44dvHlTX" verifyCallback={captchaVerified} /> //use this one on production - <ReCaptcha sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI" verifyCallback={captchaVerified} /> //test key, from google, do not use this one on production + <ReCaptcha sitekey="6LfxuKUUAAAAAIzYpCzEtJyeE8QRjBYa44dvHlTX" verifyCallback={captchaVerified} /> //use this one on production + //<ReCaptcha sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI" verifyCallback={captchaVerified} /> //test key, from google, do not use this one on production } </div> </Grid> diff --git a/src/env.js b/src/env.js index 7284c42754e5c679138196c2bae2a2f128779c2b..95815e96e0a4b6d934c32704a85f04284e77d16e 100644 --- a/src/env.js +++ b/src/env.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -var apiDomain = 'https://api.portalmectest.c3sl.ufpr.br', +var apiDomain = 'https://api.portalmec.c3sl.ufpr.br', apiVersion = 'v1', apiUrl = apiDomain + '/' + apiVersion;