Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
1db1c2e7
Commit
1db1c2e7
authored
Mar 10, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enabling LDAP working again
LDAP/Github oauth and Google oauth no credentials/parameters are rejected now
parent
da3fcb9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
+23
-16
admin.py
cps/admin.py
+20
-13
main.js
cps/static/js/main.js
+3
-3
No files found.
cps/admin.py
View file @
1db1c2e7
...
@@ -385,7 +385,7 @@ def configuration_helper(origin):
...
@@ -385,7 +385,7 @@ def configuration_helper(origin):
#LDAP configurator,
#LDAP configurator,
if
"config_login_type"
in
to_save
and
to_save
[
"config_login_type"
]
==
"1"
:
if
"config_login_type"
in
to_save
and
to_save
[
"config_login_type"
]
==
"1"
:
if
"config_ldap_provider_url"
not
in
to_save
or
"config_ldap_dn"
not
in
to_save
:
if
to_save
[
"config_ldap_provider_url"
]
==
u''
or
to_save
[
"config_ldap_dn"
]
==
u''
:
ub
.
session
.
commit
()
ub
.
session
.
commit
()
flash
(
_
(
u'Please enter a LDAP provider and a DN'
),
category
=
"error"
)
flash
(
_
(
u'Please enter a LDAP provider and a DN'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
config
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
config
=
config
,
origin
=
origin
,
...
@@ -413,27 +413,34 @@ def configuration_helper(origin):
...
@@ -413,27 +413,34 @@ def configuration_helper(origin):
# GitHub OAuth configuration
# GitHub OAuth configuration
if
"config_login_type"
in
to_save
and
to_save
[
"config_login_type"
]
==
"2"
:
if
"config_login_type"
in
to_save
and
to_save
[
"config_login_type"
]
==
"2"
:
if
"config_github_oauth_client_id"
in
to_save
:
if
to_save
[
"config_github_oauth_client_id"
]
==
u''
or
to_save
[
"config_github_oauth_client_secret"
]
==
u''
:
ub
.
session
.
commit
()
flash
(
_
(
u'Please enter Github oauth credentials'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
config
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
else
:
content
.
config_login_type
=
ub
.
LOGIN_OAUTH_GITHUB
content
.
config_github_oauth_client_id
=
to_save
[
"config_github_oauth_client_id"
]
content
.
config_github_oauth_client_id
=
to_save
[
"config_github_oauth_client_id"
]
if
"config_github_oauth_client_secret"
in
to_save
:
content
.
config_github_oauth_client_secret
=
to_save
[
"config_github_oauth_client_secret"
]
content
.
config_github_oauth_client_secret
=
to_save
[
"config_github_oauth_client_secret"
]
if
content
.
config_github_oauth_client_id
!=
config
.
config_github_oauth_client_id
or
\
content
.
config_github_oauth_client_secret
!=
config
.
config_github_oauth_client_secret
:
reboot_required
=
True
reboot_required
=
True
content
.
config_login_type
=
ub
.
LOGIN_OAUTH_GITHUB
# Google OAuth configuration
# Google OAuth configuration
if
"config_login_type"
in
to_save
and
to_save
[
"config_login_type"
]
==
"3"
:
if
"config_login_type"
in
to_save
and
to_save
[
"config_login_type"
]
==
"3"
:
if
"config_google_oauth_client_id"
in
to_save
:
if
to_save
[
"config_google_oauth_client_id"
]
==
u''
or
to_save
[
"config_google_oauth_client_secret"
]
==
u''
:
ub
.
session
.
commit
()
flash
(
_
(
u'Please enter Google oauth credentials'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
config
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
else
:
content
.
config_login_type
=
ub
.
LOGIN_OAUTH_GOOGLE
content
.
config_google_oauth_client_id
=
to_save
[
"config_google_oauth_client_id"
]
content
.
config_google_oauth_client_id
=
to_save
[
"config_google_oauth_client_id"
]
if
"config_google_oauth_client_secret"
in
to_save
:
content
.
config_google_oauth_client_secret
=
to_save
[
"config_google_oauth_client_secret"
]
content
.
config_google_oauth_client_secret
=
to_save
[
"config_google_oauth_client_secret"
]
if
content
.
config_google_oauth_client_id
!=
config
.
config_google_oauth_client_id
or
\
content
.
config_google_oauth_client_secret
!=
config
.
config_google_oauth_client_secret
:
reboot_required
=
True
reboot_required
=
True
content
.
config_login_type
=
ub
.
LOGIN_OAUTH_GOOGLE
if
"config_login_type"
in
to_save
and
to_save
[
"config_login_type"
]
==
"0"
:
content
.
config_login_type
=
ub
.
LOGIN_STANDARD
if
"config_log_level"
in
to_save
:
if
"config_log_level"
in
to_save
:
content
.
config_log_level
=
int
(
to_save
[
"config_log_level"
])
content
.
config_log_level
=
int
(
to_save
[
"config_log_level"
])
...
...
cps/static/js/main.js
View file @
1db1c2e7
...
@@ -34,7 +34,7 @@ $(document).on("change", "input[type=\"checkbox\"][data-control]", function () {
...
@@ -34,7 +34,7 @@ $(document).on("change", "input[type=\"checkbox\"][data-control]", function () {
$
(
document
).
on
(
"change"
,
"select[data-control]"
,
function
()
{
$
(
document
).
on
(
"change"
,
"select[data-control]"
,
function
()
{
var
$this
=
$
(
this
);
var
$this
=
$
(
this
);
var
name
=
$this
.
data
(
"control"
);
var
name
=
$this
.
data
(
"control"
);
var
showOrHide
=
$this
.
val
(
);
var
showOrHide
=
parseInt
(
$this
.
val
()
);
// var showOrHideLast = $("#" + name + " option:last").val()
// var showOrHideLast = $("#" + name + " option:last").val()
for
(
var
i
=
0
;
i
<
$
(
this
)[
0
].
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
$
(
this
)[
0
].
length
;
i
++
)
{
if
(
parseInt
(
$
(
this
)[
0
][
i
].
value
)
===
showOrHide
)
{
if
(
parseInt
(
$
(
this
)[
0
][
i
].
value
)
===
showOrHide
)
{
...
@@ -230,12 +230,12 @@ $(function() {
...
@@ -230,12 +230,12 @@ $(function() {
$
(
window
).
resize
(
function
()
{
$
(
window
).
resize
(
function
()
{
$
(
".discover .row"
).
isotope
(
"layout"
);
$
(
".discover .row"
).
isotope
(
"layout"
);
});
});
$
(
".author-expand"
).
click
(
function
()
{
$
(
".author-expand"
).
click
(
function
()
{
$
(
this
).
parent
().
find
(
"a.author-name"
).
slice
(
$
(
this
).
data
(
"authors-max"
)).
toggle
();
$
(
this
).
parent
().
find
(
"a.author-name"
).
slice
(
$
(
this
).
data
(
"authors-max"
)).
toggle
();
$
(
this
).
parent
().
find
(
"span.author-hidden-divider"
).
toggle
();
$
(
this
).
parent
().
find
(
"span.author-hidden-divider"
).
toggle
();
$
(
this
).
html
()
===
$
(
this
).
data
(
"collapse-caption"
)
?
$
(
this
).
html
(
"(...)"
)
:
$
(
this
).
html
(
$
(
this
).
data
(
"collapse-caption"
));
$
(
this
).
html
()
===
$
(
this
).
data
(
"collapse-caption"
)
?
$
(
this
).
html
(
"(...)"
)
:
$
(
this
).
html
(
$
(
this
).
data
(
"collapse-caption"
));
$
(
".discover .row"
).
isotope
(
"layout"
);
$
(
".discover .row"
).
isotope
(
"layout"
);
});
});
});
});
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