Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
pleroma-fe
Commits
ea62a55f
Commit
ea62a55f
authored
5 years ago
by
HJ
Browse files
Options
Downloads
Patches
Plain Diff
fix login
parent
9fd44e4a
No related branches found
No related tags found
1 merge request
!681
fix login
Pipeline
#8932
passed
5 years ago
Stage: lint
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/index.js
+5
-0
5 additions, 0 deletions
config/index.js
src/services/new_api/oauth.js
+4
-4
4 additions, 4 deletions
src/services/new_api/oauth.js
with
9 additions
and
4 deletions
config/index.js
+
5
−
0
View file @
ea62a55f
...
...
@@ -38,6 +38,11 @@ module.exports = {
changeOrigin
:
true
,
cookieDomainRewrite
:
'
localhost
'
},
'
/oauth
'
:
{
target
,
changeOrigin
:
true
,
cookieDomainRewrite
:
'
localhost
'
},
'
/nodeinfo
'
:
{
target
,
changeOrigin
:
true
,
...
...
This diff is collapsed.
Click to expand it.
src/services/new_api/oauth.js
+
4
−
4
View file @
ea62a55f
import
{
reduce
}
from
'
lodash
'
const
getOrCreateApp
=
({
oauth
,
instance
})
=>
{
const
url
=
`
${
instance
}
/api/v1/apps`
const
url
=
`/api/v1/apps`
const
form
=
new
window
.
FormData
()
form
.
append
(
'
client_name
'
,
`PleromaFE_
${
Math
.
random
()}
`
)
...
...
@@ -34,14 +34,14 @@ const login = (args) => {
},
false
)
// Do the redirect...
const
url
=
`
${
args
.
instance
}
/oauth/authorize?
${
dataString
}
`
const
url
=
`/oauth/authorize?
${
dataString
}
`
window
.
location
.
href
=
url
})
}
const
getTokenWithCredentials
=
({
app
,
instance
,
username
,
password
})
=>
{
const
url
=
`
${
instance
}
/oauth/token`
const
url
=
`/oauth/token`
const
form
=
new
window
.
FormData
()
form
.
append
(
'
client_id
'
,
app
.
client_id
)
...
...
@@ -64,7 +64,7 @@ const getToken = ({app, instance, code}) => {
form
.
append
(
'
client_secret
'
,
app
.
client_secret
)
form
.
append
(
'
grant_type
'
,
'
authorization_code
'
)
form
.
append
(
'
code
'
,
code
)
form
.
append
(
'
redirect_uri
'
,
`
${
window
.
location
.
origin
}
/oauth-callback`
)
form
.
append
(
'
redirect_uri
'
,
`/oauth-callback`
)
return
window
.
fetch
(
url
,
{
method
:
'
POST
'
,
...
...
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