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
7ccc40cf
Commit
7ccc40cf
authored
Jan 13, 2019
by
Krakinou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving import LDAP
Correct optional-requirements-ldap.txt spelling
parent
82e4f113
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
2 deletions
+3
-2
ub.py
cps/ub.py
+1
-1
web.py
cps/web.py
+2
-1
optional-requirements-ldap.txt
optional-requirements-ldap.txt
+0
-0
No files found.
cps/ub.py
View file @
7ccc40cf
...
...
@@ -14,7 +14,6 @@ import json
import
datetime
from
binascii
import
hexlify
import
cli
import
ldap
engine
=
create_engine
(
'sqlite:///{0}'
.
format
(
cli
.
settingspath
),
echo
=
False
)
Base
=
declarative_base
()
...
...
@@ -802,6 +801,7 @@ else:
#get LDAP connection
def
get_ldap_connection
():
import
ldap
conn
=
ldap
.
initialize
(
'ldap://{}'
.
format
(
config
.
config_ldap_provider_url
))
return
conn
...
...
cps/web.py
View file @
7ccc40cf
...
...
@@ -57,7 +57,6 @@ from redirect import redirect_back
import
time
import
server
from
reverseproxy
import
ReverseProxied
import
ldap
try
:
from
googleapiclient.errors
import
HttpError
...
...
@@ -2344,6 +2343,7 @@ def login():
form
=
request
.
form
.
to_dict
()
user
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
func
.
lower
(
ub
.
User
.
nickname
)
==
form
[
'username'
]
.
strip
()
.
lower
())
.
first
()
if
config
.
config_use_ldap
and
user
:
import
ldap
try
:
ub
.
User
.
try_login
(
form
[
'username'
],
form
[
'password'
])
login_user
(
user
,
remember
=
True
)
...
...
@@ -2352,6 +2352,7 @@ def login():
except
ldap
.
INVALID_CREDENTIALS
:
ipAdress
=
request
.
headers
.
get
(
'X-Forwarded-For'
,
request
.
remote_addr
)
app
.
logger
.
info
(
'LDAP Login failed for user "'
+
form
[
'username'
]
+
'" IP-adress: '
+
ipAdress
)
flash
(
_
(
u"Wrong Username or Password"
),
category
=
"error"
)
elif
user
and
check_password_hash
(
user
.
password
,
form
[
'password'
])
and
user
.
nickname
is
not
"Guest"
and
not
user
.
is_authenticated
:
login_user
(
user
,
remember
=
True
)
flash
(
_
(
u"you are now logged in as: '
%(nickname)
s'"
,
nickname
=
user
.
nickname
),
category
=
"success"
)
...
...
option
n
al-requirements-ldap.txt
→
optional-requirements-ldap.txt
View file @
7ccc40cf
File moved
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