Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Accounts Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Accounts Web
Commits
d8e3bbe7
Commit
d8e3bbe7
authored
Apr 05, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a93d5549
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
25 deletions
+24
-25
src/models/user.js
src/models/user.js
+4
-9
src/utils/sso.js
src/utils/sso.js
+20
-16
No files found.
src/models/user.js
View file @
d8e3bbe7
...
...
@@ -188,16 +188,11 @@ export default {
setup
({
dispatch
,
history
})
{
let
token
=
localStorage
.
getItem
(
"
token
"
)
if
(
window
.
location
.
pathname
!=
'
/signin
'
)
{
dispatch
({
type
:
'
preLogin
'
,
payload
:
{
token
}
})
}
history
.
listen
((
a
)
=>
{
console
.
log
(
a
)
})
return
history
.
listen
(({
pathname
,
query
})
=>
{
console
.
log
(
pathname
,
query
)
if
(
pathname
==
'
/
'
||
pathname
==
'
profiles
'
)
{
dispatch
({
type
:
'
preLogin
'
,
payload
:
{
token
}
})
}
if
(
pathname
==
'
profiles
'
&&
!
token
)
{
history
.
push
(
"
/signin
"
)
...
...
src/utils/sso.js
View file @
d8e3bbe7
...
...
@@ -7,25 +7,29 @@ let sso
let
ssoString
=
url
.
searchParams
.
get
(
'
sso
'
)
if
(
ssoString
)
{
sso
=
new
URLSearchParams
(
Buffer
.
from
(
ssoString
,
'
base64
'
).
toString
())
sso
=
new
URLSearchParams
(
Buffer
.
from
(
ssoString
,
'
base64
'
).
toString
())
}
export
const
handleSSO
=
(
user
)
=>
{
let
params
=
new
URLSearchParams
()
let
url
=
new
URL
(
sso
.
get
(
"
return_sso_url
"
));
for
(
let
[
key
,
value
]
of
Object
.
entries
(
user
))
{
params
.
set
(
key
,
value
)
if
(
sso
)
{
let
params
=
new
URLSearchParams
()
let
url
=
new
URL
(
sso
.
get
(
"
return_sso_url
"
));
for
(
let
[
key
,
value
]
of
Object
.
entries
(
user
))
{
params
.
set
(
key
,
value
)
}
params
.
set
(
"
return_sso_url
"
,
sso
.
get
(
"
return_sso_url
"
))
params
.
set
(
"
nonce
"
,
sso
.
get
(
"
nonce
"
))
params
.
set
(
"
external_id
"
,
user
.
id
)
let
payload
=
Buffer
.
from
(
params
.
toString
()).
toString
(
'
base64
'
)
url
.
searchParams
.
set
(
"
sso
"
,
payload
)
url
.
searchParams
.
set
(
'
sig
'
,
crypto
.
createHmac
(
'
sha256
'
,
'
zsZv6LXHDwwtUAGa
'
).
update
(
payload
).
digest
(
'
hex
'
))
window
.
location
.
href
=
url
return
true
}
else
{
return
false
}
params
.
set
(
"
return_sso_url
"
,
sso
.
get
(
"
return_sso_url
"
))
params
.
set
(
"
nonce
"
,
sso
.
get
(
"
nonce
"
))
params
.
set
(
"
external_id
"
,
user
.
id
)
let
payload
=
Buffer
.
from
(
params
.
toString
()).
toString
(
'
base64
'
)
url
.
searchParams
.
set
(
"
sso
"
,
payload
)
url
.
searchParams
.
set
(
'
sig
'
,
crypto
.
createHmac
(
'
sha256
'
,
'
zsZv6LXHDwwtUAGa
'
).
update
(
payload
).
digest
(
'
hex
'
))
window
.
location
.
href
=
url
return
true
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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