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
cd53d575
Commit
cd53d575
authored
Oct 10, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for remote login
parent
ac548994
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
MyLoginManager.py
cps/MyLoginManager.py
+34
-0
__init__.py
cps/__init__.py
+2
-2
No files found.
cps/MyLoginManager.py
0 → 100644
View file @
cd53d575
# -*- coding: utf-8 -*-
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2018-2019 OzzieIsaacs, cervinko, jkrehm, bodybybuddha, ok11,
# andy29485, idalin, Kyosfonica, wuqi, Kennyl, lemmsh,
# falgh1, grunjol, csitko, ytils, xybydy, trasba, vrabe,
# ruben-herold, marblepebble, JackED42, SiphonSquirrel,
# apetresc, nanu-c, mutschler, GammaC0de, vuolter
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
flask_login
import
LoginManager
from
flask
import
session
class
MyLoginManager
(
LoginManager
):
def
_session_protection_failed
(
self
):
sess
=
session
.
_get_current_object
()
ident
=
self
.
_session_identifier_generator
()
if
(
sess
and
not
(
len
(
sess
)
==
1
and
sess
.
get
(
'csrf_token'
,
None
)))
and
ident
!=
sess
.
get
(
'_id'
,
None
):
return
super
()
.
_session_protection_failed
()
return
False
cps/__init__.py
View file @
cd53d575
...
@@ -28,7 +28,7 @@ from babel import Locale as LC
...
@@ -28,7 +28,7 @@ from babel import Locale as LC
from
babel
import
negotiate_locale
from
babel
import
negotiate_locale
from
babel.core
import
UnknownLocaleError
from
babel.core
import
UnknownLocaleError
from
flask
import
Flask
,
request
,
g
from
flask
import
Flask
,
request
,
g
from
flask_login
import
LoginManager
from
.MyLoginManager
import
My
LoginManager
from
flask_babel
import
Babel
from
flask_babel
import
Babel
from
flask_principal
import
Principal
from
flask_principal
import
Principal
...
@@ -75,7 +75,7 @@ app.config.update(
...
@@ -75,7 +75,7 @@ app.config.update(
)
)
lm
=
LoginManager
()
lm
=
My
LoginManager
()
lm
.
login_view
=
'web.login'
lm
.
login_view
=
'web.login'
lm
.
anonymous_user
=
ub
.
Anonymous
lm
.
anonymous_user
=
ub
.
Anonymous
lm
.
session_protection
=
'strong'
lm
.
session_protection
=
'strong'
...
...
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