Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma-fe
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
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
Ilja
pleroma-fe
Commits
f4f63d32
Commit
f4f63d32
authored
7 years ago
by
eal
Browse files
Options
Downloads
Patches
Plain Diff
Fix basicauth base64 encoding for unicode passwords.
parent
f72d6ec8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/services/api/api.service.js
+11
-1
11 additions, 1 deletion
src/services/api/api.service.js
with
11 additions
and
1 deletion
src/services/api/api.service.js
+
11
−
1
View file @
f4f63d32
...
...
@@ -43,6 +43,16 @@ let fetch = (url, options) => {
return
oldfetch
(
fullUrl
,
options
)
}
// from https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
let
utoa
=
(
str
)
=>
{
// first we use encodeURIComponent to get percent-encoded UTF-8,
// then we convert the percent encodings into raw bytes which
// can be fed into btoa.
return
btoa
(
encodeURIComponent
(
str
)
.
replace
(
/%
([
0-9A-F
]{2})
/g
,
(
match
,
p1
)
=>
{
return
String
.
fromCharCode
(
'
0x
'
+
p1
)
}))
}
// Params
// cropH
// cropW
...
...
@@ -156,7 +166,7 @@ const register = (params) => {
const
authHeaders
=
(
user
)
=>
{
if
(
user
&&
user
.
username
&&
user
.
password
)
{
return
{
'
Authorization
'
:
`Basic
${
b
toa
(
`
${
user
.
username
}
:
${
user
.
password
}
`
)}
`
}
return
{
'
Authorization
'
:
`Basic
${
u
toa
(
`
${
user
.
username
}
:
${
user
.
password
}
`
)}
`
}
}
else
{
return
{
}
}
...
...
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