Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SSHOC
sshoc-marketplace-frontend
Commits
9c49e748
Commit
9c49e748
authored
Jun 30, 2021
by
Stefan Probst
Browse files
fix: fix check for token length
parent
6595d6e4
Pipeline
#208115
passed with stages
in 11 minutes and 2 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/screens/auth/SignInScreen.tsx
View file @
9c49e748
import
Image
from
'
next/image
'
import
{
useRouter
}
from
'
next/router
'
import
{
Fragment
,
useEffect
,
useMemo
}
from
'
react
'
import
{
toast
}
from
'
react-toastify
'
import
{
useSignInUser
,
useValidateImplicitGrantTokenWithoutRegistration
,
}
from
'
@/api/sshoc/client
'
import
{
Button
}
from
'
@/elements/Button/Button
'
import
{
toast
}
from
'
@/elements/Toast/useToast
'
import
{
useAuth
}
from
'
@/modules/auth/AuthContext
'
import
{
FormTextField
}
from
'
@/modules/form/components/FormTextField/FormTextField
'
import
{
Form
}
from
'
@/modules/form/Form
'
...
...
src/screens/auth/SignUpScreen.tsx
View file @
9c49e748
...
...
@@ -2,12 +2,12 @@ import Image from 'next/image'
import
{
useRouter
}
from
'
next/router
'
import
{
Fragment
,
useEffect
}
from
'
react
'
import
{
useQueryClient
}
from
'
react-query
'
import
{
toast
}
from
'
react-toastify
'
import
{
useRegisterOAuth2User
}
from
'
@/api/sshoc
'
import
{
useValidateImplicitGrantTokenWithRegistration
}
from
'
@/api/sshoc/client
'
import
{
Button
}
from
'
@/elements/Button/Button
'
import
{
ProgressSpinner
}
from
'
@/elements/ProgressSpinner/ProgressSpinner
'
import
{
toast
}
from
'
@/elements/Toast/useToast
'
import
{
useAuth
}
from
'
@/modules/auth/AuthContext
'
import
{
FormCheckBox
}
from
'
@/modules/form/components/FormCheckBox/FormCheckBox
'
import
{
FormTextField
}
from
'
@/modules/form/components/FormTextField/FormTextField
'
...
...
@@ -203,7 +203,11 @@ function useValidateAuthCode() {
const
url
=
createUrlFromPath
(
router
.
asPath
)
const
{
hash
}
=
url
if
(
hash
&&
hash
.
length
===
69
)
{
/**
* The develop egi instance uses 68+1 chars, the demo instance (which is used on staging)
* uses 64+1 chars.
*/
if
(
hash
&&
(
hash
.
length
===
69
||
hash
.
length
===
65
))
{
/** remove leading "#" character */
const
authCode
=
hash
.
slice
(
1
)
/**
...
...
@@ -223,6 +227,9 @@ function useValidateAuthCode() {
shallow
:
true
,
},
)
}
else
{
toast
.
error
(
'
Received invalid token.
'
)
router
.
replace
({
pathname
:
'
/auth/sign-in
'
})
}
},
[
router
,
auth
,
validateToken
,
status
])
...
...
src/screens/contact/ContactScreen.tsx
View file @
9c49e748
import
Image
from
'
next/image
'
import
{
useRouter
}
from
'
next/router
'
import
{
Fragment
}
from
'
react
'
import
{
toast
}
from
'
react-toastify
'
import
{
Button
}
from
'
@/elements/Button/Button
'
import
{
toast
}
from
'
@/elements/Toast/useToast
'
import
{
useQueryParam
}
from
'
@/lib/hooks/useQueryParam
'
import
{
FormTextArea
}
from
'
@/modules/form/components/FormTextArea/FormTextArea
'
import
{
FormTextField
}
from
'
@/modules/form/components/FormTextField/FormTextField
'
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment