From 99334b34c45dbf0889b2864adb82c33e40c4200f Mon Sep 17 00:00:00 2001 From: Vinicius Gabriel Machado <vgm18@inf.ufpr.br> Date: Thu, 17 Jun 2021 10:26:18 -0300 Subject: [PATCH 1/2] Updating sitekey (recaptcha) to the production one. --- src/Components/SignUpContainerFunction.js | 4 ++-- src/Components/UploadPageComponents/PartThree.js | 4 ++-- src/env.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Components/SignUpContainerFunction.js b/src/Components/SignUpContainerFunction.js index 89752091..15974aee 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/UploadPageComponents/PartThree.js b/src/Components/UploadPageComponents/PartThree.js index e751a180..5170659c 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 7284c427..95815e96 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; -- GitLab From fe9a7a7615ad2832ed5e4ca7806ebfdd55fd4057 Mon Sep 17 00:00:00 2001 From: Vinicius Gabriel Machado <vgm18@inf.ufpr.br> Date: Tue, 22 Jun 2021 11:49:26 -0300 Subject: [PATCH 2/2] Added snackbar alert in case of errors on signUp --- src/Components/SignUpModal.js | 74 ++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/src/Components/SignUpModal.js b/src/Components/SignUpModal.js index e0167807..61c4fb28 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> + </> ) } -- GitLab