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
6d2270d9
Commit
6d2270d9
authored
Mar 10, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for Oauth
parent
1db1c2e7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
20 deletions
+26
-20
admin.py
cps/admin.py
+5
-3
oauth_bb.py
cps/oauth_bb.py
+7
-6
config_view_edit.html
cps/templates/config_view_edit.html
+1
-1
user_edit.html
cps/templates/user_edit.html
+8
-7
web.py
cps/web.py
+5
-3
No files found.
cps/admin.py
View file @
6d2270d9
...
...
@@ -172,6 +172,11 @@ def view_configuration():
# Mature Content configuration
if
"config_mature_content_tags"
in
to_save
:
content
.
config_mature_content_tags
=
to_save
[
"config_mature_content_tags"
]
.
strip
()
if
"Show_mature_content"
in
to_save
:
content
.
config_default_show
=
content
.
config_default_show
+
ub
.
MATURE_CONTENT
if
"config_authors_max"
in
to_save
:
content
.
config_authors_max
=
int
(
to_save
[
"config_authors_max"
])
# Default user configuration
content
.
config_default_role
=
0
...
...
@@ -196,9 +201,6 @@ def view_configuration():
val
+=
int
(
key
[
5
:])
content
.
config_default_show
=
val
if
"Show_mature_content"
in
to_save
:
content
.
config_default_show
=
content
.
config_default_show
+
ub
.
MATURE_CONTENT
ub
.
session
.
commit
()
flash
(
_
(
u"Calibre-Web configuration updated"
),
category
=
"success"
)
config
.
loadSettings
()
...
...
cps/oauth_bb.py
View file @
6d2270d9
...
...
@@ -223,11 +223,12 @@ if ub.oauth_support:
except
Exception
as
e
:
app
.
logger
.
exception
(
e
)
ub
.
session
.
rollback
()
if
config
.
config_public_reg
:
return
redirect
(
url_for
(
'web.register'
))
else
:
flash
(
_
(
u"Public registration is not enabled"
),
category
=
"error"
)
redirect
(
url_for
(
redirect_url
))
return
redirect
(
url_for
(
'web.login'
))
#if config.config_public_reg:
# return redirect(url_for('web.register'))
#else:
# flash(_(u"Public registration is not enabled"), category="error")
# return redirect(url_for(redirect_url))
except
NoResultFound
:
return
redirect
(
url_for
(
redirect_url
))
...
...
@@ -306,7 +307,7 @@ if ub.oauth_support:
return
unlink_oauth
(
github_blueprint
.
name
)
@
oauth
.
route
(
'/google'
)
@
oauth
.
route
(
'/
login/
google'
)
@
google_oauth_required
def
google_login
():
if
not
google
.
authorized
:
...
...
cps/templates/config_view_edit.html
View file @
6d2270d9
...
...
@@ -29,7 +29,7 @@
</div>
<div
class=
"form-group"
>
<label
for=
"config_authors_max"
>
{{_('No. of authors to show before hiding (0=disable hiding)')}}
</label>
<input
type=
"number"
min=
"0"
max=
"999"
class=
"form-control"
name=
"config_authors_max"
id=
"config_authors_max"
value=
"{% if con
tent.config_authors_max != None %}{{ content
.config_authors_max }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"number"
min=
"0"
max=
"999"
class=
"form-control"
name=
"config_authors_max"
id=
"config_authors_max"
value=
"{% if con
f.config_authors_max != None %}{{ conf
.config_authors_max }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_theme"
>
{{_('Theme')}}
</label>
...
...
cps/templates/user_edit.html
View file @
6d2270d9
...
...
@@ -35,6 +35,7 @@
{% endfor %}
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"default_language"
>
{{_('Show books with language')}}
</label>
<select
name=
"default_language"
id=
"default_language"
class=
"form-control"
>
...
...
@@ -44,21 +45,21 @@
{% endfor %}
</select>
</div>
{% if registered_oauth.keys()| length > 0 %}
<div
class=
"form-group"
>
<label
for=
"oauth_settings"
>
{{_('OAuth Settings')}}
</label>
<br/>
{% for oauth, name in registered_oauth.iteritems() %}
<label
for=
"config_{{ oauth }}_oauth"
style=
"margin-left: 15px"
>
{{ name }}
</label>
<div
class=
"form-group"
>
<label>
{{ name }} {{_('OAuth Settings')}}
</label>
{% if oauth not in oauth_status %}
<a
href=
"/cw/github"
target=
"_blank"
style=
"margin-left: 5px"
>
Link
</a>
<!-- ToDo: Not really working--
>
<div><a
href=
"{{ url_for(oauth +'.login') }}"
id=
"config_{{ oauth }}_oauth"
class=
"btn btn-primary"
>
{{_('Link')}}
</a></div
>
{% else %}
<a
href=
"{{ url_for('oauth.github_login_unlink') }}"
style=
"margin-left: 5px"
>
{{_('Unlink')}}
</a>
<!-- ToDo: Google not working--
>
<div><a
href=
"{{ url_for('oauth.'+ oauth +'_login_unlink') }}"
id=
"config_{{ oauth }}_oauth"
class=
"btn btn-primary"
>
{{_('Unlink')}}
</a></div
>
{% endif %}
<br/>
{% endfor %}
</div>
{% endif %}
<div
class=
"col-sm-6"
>
{% for element in sidebar %}
{% if element['config_show'] %}
...
...
cps/web.py
View file @
6d2270d9
...
...
@@ -1527,7 +1527,8 @@ def profile():
if
config
.
config_public_reg
and
not
check_valid_domain
(
to_save
[
"email"
]):
flash
(
_
(
u"E-mail is not from valid domain"
),
category
=
"error"
)
return
render_title_template
(
"user_edit.html"
,
content
=
current_user
,
downloads
=
downloads
,
title
=
_
(
u"
%(name)
s's profile"
,
name
=
current_user
.
nickname
))
title
=
_
(
u"
%(name)
s's profile"
,
name
=
current_user
.
nickname
),
page
=
"me"
,
registered_oauth
=
oauth_check
,
oauth_status
=
oauth_status
)
current_user
.
email
=
to_save
[
"email"
]
if
"show_random"
in
to_save
and
to_save
[
"show_random"
]
==
"on"
:
current_user
.
random_books
=
1
...
...
@@ -1552,8 +1553,9 @@ def profile():
ub
.
session
.
rollback
()
flash
(
_
(
u"Found an existing account for this e-mail address."
),
category
=
"error"
)
return
render_title_template
(
"user_edit.html"
,
content
=
current_user
,
downloads
=
downloads
,
title
=
_
(
u"
%(name)
s's profile"
,
name
=
current_user
.
nickname
,
registered_oauth
=
oauth_check
,
oauth_status
=
oauth_status
))
translations
=
translations
,
title
=
_
(
u"
%(name)
s's profile"
,
name
=
current_user
.
nickname
),
page
=
"me"
,
registered_oauth
=
oauth_check
,
oauth_status
=
oauth_status
)
flash
(
_
(
u"Profile updated"
),
category
=
"success"
)
return
render_title_template
(
"user_edit.html"
,
translations
=
translations
,
profile
=
1
,
languages
=
languages
,
content
=
current_user
,
downloads
=
downloads
,
title
=
_
(
u"
%(name)
s's profile"
,
...
...
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