Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
11a32135
Commit
11a32135
authored
Oct 29, 2020
by
Lucas Eduardo Schoenfelder
Browse files
Options
Downloads
Patches
Plain Diff
backup mectest changes
parent
b844fa56
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/App.js
+3
-5
3 additions, 5 deletions
src/App.js
src/Components/Header.js
+40
-2
40 additions, 2 deletions
src/Components/Header.js
src/Components/LoginContainer.js
+6
-28
6 additions, 28 deletions
src/Components/LoginContainer.js
with
49 additions
and
35 deletions
src/App.js
+
3
−
5
View file @
11a32135
...
...
@@ -24,7 +24,7 @@ import EcFooter from './Components/EcFooter';
import
GNUAGPLfooter
from
'
./Components/AGPLFooter
'
;
import
UserPage
from
'
./Pages/UserPage
'
;
import
UserTerms
from
'
./Pages/UserTerms
'
;
import
{
useLocation
}
from
'
react-router-dom
'
import
Teste
from
'
./Pages/Teste
'
;
import
ResourcePage
from
'
./Pages/ResourcePage
'
;
...
...
@@ -32,7 +32,6 @@ import {BrowserRouter, Switch, Route} from 'react-router-dom';
import
{
Store
}
from
'
./Store
'
import
TermsPage
from
'
./Pages/TermsPage.js
'
import
PublicationPermissionsPage
from
'
./Pages/PublicationPermissionsPage.js
'
import
LoginCallbackHandler
from
'
./Components/LoginCallbackHandler.js
'
export
default
function
App
(){
// eslint-disable-next-line
...
...
@@ -65,11 +64,11 @@ export default function App(){
},[
window
.
innerWidth
,
window
.
innerHeight
])
return
(
<
BrowserRouter
>
<
BrowserRouter
basename
=
"
/react
"
>
<
Header
/>
<
div
style
=
{{
backgroundImage
:
"
linear-gradient(to right,#ff7f00,#e81f4f,#673ab7,#00bcd4)
"
,
height
:
"
5px
"
}}
><
/div
>
<
Switch
>
<
Route
path
=
"
/
home
"
exact
=
{
true
}
component
=
{
Home
}
/
>
<
Route
path
=
"
/
"
exact
=
{
true
}
component
=
{
Home
}
/
>
<
Route
path
=
"
/busca
"
component
=
{
Search
}
/
>
<
Route
path
=
"
/perfil-atualizacoes
"
component
=
{
UserPage
}
/
>
<
Route
path
=
"
/recurso
"
component
=
{
ResourcePage
}
/
>
...
...
@@ -77,7 +76,6 @@ export default function App(){
<
Route
path
=
"
/termos-publicar-recurso
"
component
=
{
TermsPage
}
/
>
<
Route
path
=
"
/permission
"
component
=
{
PublicationPermissionsPage
}
/
>
{
/*<Route path="termos-de-uso#publicacoes-de-usuario" component={}*/
}
<
Route
path
=
"
/omniauth/google_oauth2/callback
"
component
=
{
LoginCallbackHandler
}
/
>
<
Route
path
=
"
/termos
"
component
=
{
UserTerms
}
/
>
<
Route
path
=
"
/teste
"
component
=
{
Teste
}
/
>
...
...
This diff is collapsed.
Click to expand it.
src/Components/Header.js
+
40
−
2
View file @
11a32135
...
...
@@ -16,7 +16,9 @@ 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
,
useState
}
from
'
react
'
import
React
,
{
useContext
,
useState
,
useEffect
}
from
'
react
'
import
axios
from
'
axios
'
import
{
apiUrl
}
from
'
../env
'
import
AcessibilityBar
from
'
./AcessibilityBar
'
import
MenuBar
from
'
./MenuBar
'
...
...
@@ -25,16 +27,52 @@ import SignUpModal from './SignUpModal'
import
LoginModal
from
'
./LoginModal
'
import
{
Store
}
from
'
../Store
'
;
import
ColaborarModal
from
'
./ColaborarModal.js
'
import
{
useLocation
}
from
'
react-router-dom
'
//const StyledButton = styled(Button)`
// background : #ffa54c !important;
// boxShadow :none;
//`
//
export
default
function
Header
(
props
){
const
{
state
,
dispatch
}
=
useContext
(
Store
)
const
[
signUpOpen
,
setSignUp
]
=
useState
(
false
)
const
[
loginOpen
,
setLogin
]
=
useState
(
false
)
let
loc
=
useLocation
()
useEffect
(()
=>
{
console
.
log
(
loc
)
let
query
=
new
URLSearchParams
(
loc
.
search
)
//POR PARAMETRO
console
.
log
(
query
.
getAll
(
"
auth_token
"
))
if
(
query
.
get
(
"
auth_token
"
)
!=
undefined
)
{
let
config
=
{
headers
:
{
"
access-token
"
:
query
.
get
(
"
auth_token
"
),
"
client
"
:
query
.
get
(
"
client_id
"
),
"
uid
"
:
query
.
get
(
"
uid
"
),
"
expiry
"
:
query
.
get
(
"
expiry
"
),
"
token-type
"
:
'
Bearer
'
}
}
axios
.
get
(
`
${
apiUrl
}
/auth/validate_token/`
,
config
).
then
(
(
res
)
=>
{
console
.
log
(
res
)},
(
err
)
=>
{
console
.
log
(
err
)}
)
}
//POR URL
{
/*
let urlParams = [
`access_token=${query.get("auth_token")}`,
`client=${query.get("client_id")}`,
`uid=${query.get("uid")}`,
].join('&')
axios.get(`${apiUrl}/auth/validate_token?${urlParams}`).then(
(res) => {console.log(res)}, (err) => {console.log(err)}
)*/
}
},
[
loc
])
const
handleSignUp
=
()
=>
{
setSignUp
(
!
signUpOpen
)
...
...
This diff is collapsed.
Click to expand it.
src/Components/LoginContainer.js
+
6
−
28
View file @
11a32135
...
...
@@ -26,25 +26,11 @@ import LabeledCheckbox from './Checkbox.js'
import
FormInput
from
"
./FormInput.js
"
import
axios
from
'
axios
'
import
{
apiUrl
}
from
'
../env
'
;
//arrumar isso
const
responseGoogle
=
(
response
)
=>
{
console
.
log
(
response
);
let
currUrl
=
window
.
location
.
href
console
.
log
(
currUrl
)
axios
.
post
((
`
${
apiUrl
}
/auth/google_oauth2?auth_origin_url=`
+
currUrl
+
'
&omniauth_window_type=sameWindow
'
),
response
).
then
(
(
response
)
=>
{
console
.
log
(
response
.
data
)},
(
error
)
=>
{
console
.
log
(
error
)}
)
}
async
function
handleGoogle
()
{
try
{
const
response
=
await
axios
.
get
(
'
https://api.portalmec.c3sl.ufpr.br/v1/omniauth/google_oauth2?auth_origin_url=https://api.portalmectest.c3sl.ufpr.br/react/&omniauth_window_type=sameWindow&resource_class=User
'
);
console
.
log
(
response
);
const
url
=
await
response
.
text
;
window
.
location
.
assign
(
url
);
}
catch
(
e
)
{
console
.
log
(
e
)
}
async
function
handleGoogleAttempt
()
{
console
.
log
(
"
handleGoogleAttempt
"
)
let
request_url
=
'
https://api.portalmec.c3sl.ufpr.br/v1/omniauth/google_oauth2?auth_origin_url=
'
+
window
.
location
.
href
+
'
&omniauth_window_type=sameWindow&resource_class=User
'
window
.
location
.
replace
(
request_url
)
}
class
LoginContainer
extends
Component
{
...
...
@@ -99,15 +85,7 @@ class LoginContainer extends Component {
<
div
style
=
{{
paddingTop
:
"
20px
"
}}
>
<
div
style
=
{{
marginTop
:
"
0
"
}}
>
{
/*<StyledGoogleLoginButton
clientId="288460085642-k4veg4fo8kddvjer8b055n9da5qtgha7.apps.googleusercontent.com"
onSuccess={responseGoogle}
onFailure={responseGoogle}
cookiePolicy={'single_host_origin'}
>
<span style={{textTransform:"none", fontSize:"13px"}}>Usando o Google</span>
</StyledGoogleLoginButton>*/
}
<
Button
onClick
=
{
handleGoogle
}
>
login
com
google
<
/Button
>
<
Button
onClick
=
{
handleGoogleAttempt
}
>
login
com
google
<
/Button
>
<
/div
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment